我放在header前他报错
Notice: Undefined variable: _post in E:\Apache2.2\htdocs\ro\mes.php on line 2Notice: Undefined variable: _post in E:\Apache2.2\htdocs\ro\mes.php on line 4
Notice: Undefined variable: _post in E:\Apache2.2\htdocs\ro\mes.php on line 2Notice: Undefined variable: _post in E:\Apache2.2\htdocs\ro\mes.php on line 4
但是小弟用下面这段代码写不进数据库
值已经取到了我测试过了,SQL语句也没问题
但是为什么值传进来后写不进数据库呢
<?php $Time = date('H:i,jS F'); $connect = mysql_connect("localhost","root","p@ssw0rd"); $select = mysql_select_db("ragnarok",$connect); if($_SERVER['REQUEST_METHOD'] == "POST")
{
$Name = $_POST['Name'];
$Message = $_POST['Message'];
} $sql = "INSERT INTO `message`(`Name`,`Message`,`Time`) VALUES ('$Name' , '$Message' , '$Time')"; mysql_query($sql , $connect);
echo" <center>
<table>
<tr>
<td height='200'> </td>
</tr>
</table> <center><table style='border:2px dashed #FFF1B2'>
<tr>
<td align='center'>
发表成功
</td>
</tr>
<tr>
<td align='center'><a href='mes.php'>点此返回留言板 </a> </td>
</tr>
</table></center>";
$close = mysql_close($connect);?>
传成功了
我Time是VARCHAR类型长度50