php提交表单时提示“undefined index submit”
数据是进入数据库了,为什么会提示这行?include("conn.php");if($_POST['submit']){$sql="insertintomessage(i...
数据是进入数据库了,为什么会提示这行?
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");
?>
<form action="add.php" method="post" name="myform" onsubmit="return CheckPost();">
用户:<input type="text" size="10" name="user" /><br>
标题:<input type="text" name="title" /><br/>
内容:<textarea name="content" cols="60" rows="9"></textarea><br/>
<input type="submit" name="submit" value="发布留言"/>
</form> 展开
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");
?>
<form action="add.php" method="post" name="myform" onsubmit="return CheckPost();">
用户:<input type="text" size="10" name="user" /><br>
标题:<input type="text" name="title" /><br/>
内容:<textarea name="content" cols="60" rows="9"></textarea><br/>
<input type="submit" name="submit" value="发布留言"/>
</form> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询