我试图这样做,当点击一个按钮时会创建一个弹出窗口但是我有这个错误“解析错误:语法错误,意外'<'在第55行的C:\ xampp \ htdocs \ project \ calendar_start.php “
代码:
<?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>';
?>
答案 0 :(得分:1)
在没有更多上下文的情况下,我可以看到您在onclick语句中仅使用简单的引号('
)。在此语句中使用双引号或转义简单引号,例如:
onClick="window.open('events.php', 'View',width=300,height=200,menubar=yes,status=yes)"