[问题]php表单页面报错
初学php,也不知是什么问题,总是报这个错Parse error: parse error, unexpected T_VARIABLE in D:\web\day.php on line 2
源码如下,希望有人能指点一二
<?php include("header.inc");
$result = mysql_query("SELECT * FROM cal where 'user'="$_post['name']"",$db);
$username=mysql_query("select * from user",$db);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>day</title>
</head>
<body>
<table border="1">
<caption>
<?php echo date("l dS \of F Y") ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="name" target="_self" id="name">
<label>您的名字
<select name="select">
<?php
while ($myname = mysql_fetch_row($username)) {
printf("<option>>%s</option>\n", $myname);
}
?>
</select>
</label></form>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</caption>
<tr>
<th scope="col"></th>
<th scope="col">event</th>
<th scope="col">statu</th>
</tr>
<?php
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s<?td><td>%s</td><td>%s</td></tr>\n", $myrow, $myrow, $myrow);
}
?>
</table>
<p>&nbsp;</p>
</body>
</html> due to line 2, you guy should pay some attention to the SQL.
$result = mysql_query("SELECT * FROM cal WHERE user= '" . $_post['name'] . "'",$db);
:roll:
楼主已经被字符串加法闹晕菜了. 呵呵
页:
[1]