21,893
社区成员




$conn=mysql_connect("localhost","root","yang") or die("提示:连接错误!");
if($conn){
echo "提示:数据库连接成功!";
/*打开数据库*/
mysql_select_db("bbs",$conn);
/*使用GBK中文编码;*/
mysql_query("set names 'GBK'");
}
if($_POST['submit']){
echo $sql= "insert into message (id,user,title,content,lastdate)".
"values(' ','$_post[user]','$_post[title]','$_post[content]',now())";
}
<!----
*HTML代码部分
-->
<form action="add.php" method ="post">
用户:<input type="text" size="20" name="user"/><br/>
标题:<input type="text" name="title"/><br/>
内容:<textarea name="content" rows="10" cols="70"></textarea><br/><br/>
<input type="submit" name ="submit" value ="发布留言"/>
</form>