<?php
include ("conn.php");
if('$_POST[submit]'){
$sql = "insert into message(id,user,title,content,lastdate)".
"values('','$_GET[user]',$_GET[title],$_GET[content],now())";
echo $sql;
$arr = @mysql_query($sql)or die("建立失败");
echo $sql;
echo "成功";}
?>
<form action = "add.php" method = "get">
用户:<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>Notice: Undefined index: user in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5Notice: Undefined index: title in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5Notice: Undefined index: content in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5
insert into message(id,user,title,content,lastdate)values('','',,,now())建立失败
数据库连接时正常的 求助
include ("conn.php");
if('$_POST[submit]'){
$sql = "insert into message(id,user,title,content,lastdate)".
"values('','$_GET[user]',$_GET[title],$_GET[content],now())";
echo $sql;
$arr = @mysql_query($sql)or die("建立失败");
echo $sql;
echo "成功";}
?>
<form action = "add.php" method = "get">
用户:<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>Notice: Undefined index: user in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5Notice: Undefined index: title in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5Notice: Undefined index: content in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\bbs2\add.php on line 5
insert into message(id,user,title,content,lastdate)values('','',,,now())建立失败
数据库连接时正常的 求助
xxxx...
if($_POST['submit']){
$sql = "insert into message(id,user,title,content,lastdate)".
"values('','$_GET[user]',$_GET[title],$_GET[content],now())";
echo $sql;
$arr = @mysql_query($sql)or die("建立失败");
echo $sql;
echo "成功";
}
}
<form action = "add.php" method = "get">
用户:<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> 我明明定义了
信息,说明$_get[user]时有值的,可是判定却是空,而且 masql_query($sql)也是错误,我真的不知道怎么回事了,跟视频教学上一模一样啊
"values('','$_GET[user]',$_GET[title],$_GET[content],now())";$_GET[title] , $_GET[content]都没有‘’,看看是不是这个原因!