PHP编程问题
conn.php<?php
/*
* Created on 2008-9-13
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$conn = @ mysql_connect("localhost", "root", "") or die("数据库链接错误");
mysql_select_db("love", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
add.php
<?php
/*
* Created on 2008-9-13
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("conn.php");
if($_POST['submit']){
$sql="insert into message (id,user,title,content,lastdate)".
"values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
echo"发布成功";
}
?>
<form action="add.php" method="POST">
名字:
<input type="text" size="50" name="user" /></br>
标题:
<input type="text" name="title" /><br/>
留言:
<textarea name="content" ></textarea><br>
<input type="submit" name="submit" value="发布留言"/>
</form>
为什么代码什么的都是对的.不来上传到数据库.
数据库里没有显示呢.