简体   繁体   English

点击按钮弹出

[英]Pop up on button click

I am trying to make it so when a button is clicked it creates a pop up however I have this error " Parse error: syntax error, unexpected '<' in C:\\xampp\\htdocs\\project\\calendar_start.php on line 55 " 我试图这样做,所以当单击按钮时会弹出一个对话框,但是我遇到此错误“ 解析错误:语法错误,C:\\ xampp \\ htdocs \\ project \\ calendar_start.php在行55上出现意外的<<

Code: 码:

    <?php
$showmonth = $_POST['showmonth'];
$showyear = $_POST['showyear'];
$showmonth= preg_replace('#[^0-9]#i', '', $showmonth);
$showyear= preg_replace('#[^0-9]#i', '', $showyear);

$day_count = cal_days_in_month(CAL_GREGORIAN, $showmonth, $showyear);
$pre_days = date('w', mktime(0,0,0, $showmonth, 1, $showyear));
$post_days = (6-(date('w', mktime(0,0,0, $showmonth, $day_count, $showyear))));

echo '<div id="calendar_wrap">';
echo '<div class="title_bar">';
echo '<div class="previous_month"><input name="button" type="submit" value="Previous Month" onClick="javascript:last_month();"></div>';
echo '<div class="show_month">'  . date('F', mktime(0, 0, 0, $showmonth)) . ' ' . $showyear . '</div>';
echo '<div class="next_month"><input name="button" type="submit" value="Next Month" onClick="javascript:next_month();"></div>';
echo '</div>';

echo '<div class="week_days">';
echo '<div class="days_of_the_week">Sun</div>';
echo '<div class="days_of_the_week">Mon</div>';
echo '<div class="days_of_the_week">Tues</div>';
echo '<div class="days_of_the_week">Wed</div>';
echo '<div class="days_of_the_week">Thur</div>';
echo '<div class="days_of_the_week">Fri</div>';
echo '<div class="days_of_the_week">Sat</div>';
echo '<div class="clear"></div>';
echo '</div>';

if ($pre_days != 0) { 
    for($i=1; $i<=$pre_days; $i++) {
        echo '<div class="non_cal_day"></div>';
    }
}
$con=mysql_connect("localhost","root","");
mysql_select_db("familease", $con);

for ($i=1; $i<= $day_count; $i++) {

    $date = $i.'/'.$showmonth.'/'.$showyear;
    //echo $date;

    $query = "Select id FROM events WHERE evDate = '$date'";

    $num_rows = 0;
    // check if the query returns anything
    $result = mysql_query($query,$con) or die(mysql_error());

    if ($result) 
    {

        $num_rows = mysql_num_rows($result);
    }

    if($num_rows > 0) {
            <input type="submit" value="Details" 
            onClick="window.open('events.php', 'View',width=300,height=200,menubar=yes,status=yes)"">

    }

    echo '<div class="cal_day">';
    echo '<div class="day_heading">' . $i . '</div>';
    if($num_rows > 0) 
        { 
        echo "<div class='openings'><br/>" . $event . "</div>";
        }
    echo '</div>';



} //end of for loop

if ($post_days !=0) {
    for($i=1; $i<=$post_days; $i++) {
        echo '<div class="non_cal_day"></div>';
    }
}
echo '</div>';
?>

With no more context all I can see is that you use only simple quotes ( ' ) inside your onclick statement. 在没有更多上下文的情况下,我只能看到您在onclick语句内仅使用了简单的引号( ' )。 Use double quotes or escape simple quotes inside this statement such as : 在此语句中使用双引号或转义简单引号,例如:

onClick="window.open('events.php', 'View',width=300,height=200,menubar=yes,status=yes)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM