打印

[问题]php表单页面报错

[问题]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[1]);
}
?>
  </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[5], $myrow[2], $myrow[3]);
}
?>
</table>
<p> </p>
</body>
</html>

TOP

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

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

TOP


楼主已经被字符串加法闹晕菜了.
不想要 ID 了请找我。

TOP

呵呵
从现在起,要致力于推广开源文化 个人PHP Web开发资源网站 http://site.karadog.net/karaphp 欢迎各位光临

TOP