QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2533|回复: 3

[问题]php表单页面报错

[复制链接]
发表于 2006-6-20 21:44:22 | 显示全部楼层 |阅读模式
初学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>
发表于 2006-6-21 09:11:41 | 显示全部楼层
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]
回复

使用道具 举报

发表于 2006-6-21 13:57:56 | 显示全部楼层

楼主已经被字符串加法闹晕菜了.
回复

使用道具 举报

发表于 2006-6-22 21:19:16 | 显示全部楼层
呵呵
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-18 21:41 , Processed in 0.107131 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表