为什么表单提交不到数据库 100
已经提示发布成功~可是数据库就是没反应<?phpinclude'conn.php';if(isset($_POST['submit'])&&$_POST['submit'...
已经提示发布成功~可是数据库就是没反应
<?php
include 'conn.php';
if (isset($_POST['submit'])&& $_POST['submit'])
{
$sql="insert into message (id,user,title,content,lastdate) " .
"values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
echo "发布成功";
}
?>
<form action="add.php" method="post">
用户:<input type="text" size="10" name="user"><br>
标题:<input type="text" name="title"><br>
内容:<textarea name="content"></textarea><br>
<input type="submit" name="submit" value="发布留言">
</form>
?php
$conn = @ mysql_connect("localhost", "admin", "admin") or die("数据库链接错误");
mysql_select_db("liuyanban", $conn);
mysql_query("set names 'GBK'");
?> 展开
<?php
include 'conn.php';
if (isset($_POST['submit'])&& $_POST['submit'])
{
$sql="insert into message (id,user,title,content,lastdate) " .
"values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
echo "发布成功";
}
?>
<form action="add.php" method="post">
用户:<input type="text" size="10" name="user"><br>
标题:<input type="text" name="title"><br>
内容:<textarea name="content"></textarea><br>
<input type="submit" name="submit" value="发布留言">
</form>
?php
$conn = @ mysql_connect("localhost", "admin", "admin") or die("数据库链接错误");
mysql_select_db("liuyanban", $conn);
mysql_query("set names 'GBK'");
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询