wyfha 发表于 2006-6-20 21:44:22

[问题]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> </p>
</body>
</html>

涩兔子 发表于 2006-6-21 09:11:41

due to line 2, you guy should pay some attention to the SQL.


$result = mysql_query("SELECT * FROM cal WHERE user= '" . $_post['name'] . "'",$db);

jiangtao9999 发表于 2006-6-21 13:57:56

:roll:
楼主已经被字符串加法闹晕菜了.

KarajanLee 发表于 2006-6-22 21:19:16

呵呵
页: [1]
查看完整版本: [问题]php表单页面报错