php简单留言板(就一个错误)unexpected $end in

来源:百度知道 编辑:UC知道 时间:2024/07/05 02:47:26
<?php
include("conn.php");

if($_POST['submit']){

$sql="insert into message (id,user,title,content,lastdate) " .
"values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
echo "<script language=\"javascript\">alert('添加成功');history.go(-1)</script>";

}
include("head.php");
?>
<SCRIPT language=javascript>
function CheckPost()
{
if (myform.user.value=="")
{
alert("请填写用户名");
myform.user.focus();
return false;
}
if (myform.title.value.length<5)
{
alert("标题不能少于5个字符");
myform.title.focus();
return false;
}
if (myform.content.value=="")
{
alert("必须要填写留言内容");
myform.content.focus();

1。这个错误发生在 add.php文件中,不是发生在你贴出来的这些代码中!(这个就是add.php?)

2。错误的原因是syntax error, unexpected $end (翻译:语法错误!遇到未定义变量$end)

3. 可以看看代码是不是$end真的没定义。或者用var_dump(),print_r()函数,将$end变量打印出来。

希望对你有所帮助

少结尾符号 上面代码每问题 应该在你调用的文件里

贴test.php
不想全部贴出来就把错误行给指出来

$sql="insert into message (id,user,title,content,lastdate) " .
"values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
其中ID为自动生成,是不能更新的.
$sql="insert into message (user,title,content,lastdate) " .
"values ('$_POST[user]','$_POST[title]','$_POST[content]',now())";
没玩过PHP,只是个人看法,也不知道对不对.