<?php $conn = @ mysql_connect("localhost", "root", "") or die("error");mysql_select_db("bbs", $conn); if(isset($_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>";}?><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(); return false;}}</script>
<center><form action="message.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></center>
<table width=500 border="0" align="center" cellpadding="5"
cellspacing="1" bgcolor="$add3ef">
下面的字数限制不让打了啊啊啊
大神 请看私信
本回答被提问者采纳大神 我还没学到这么高端的。。