$ _POST不能使用简单的表单

时间:2013-03-19 21:05:23

标签: php post

不知道为什么会这样,但我的简单PHP表单不能使用$ _POST变量,返回错误。

HTML表单:

<form name = "post" action = "insert_into.php" method = "post">
<p><label for="author">Author:</label></p><input type = "text" id = "author" name = "author"> 
<p><label for="subject">Subject:</label></p><input type = "text" id = "subject" name = "subject">
<p><label for="content">Content:</label></p><textarea id = "content" rows = "8" cols = "40" name = "content"></textarea>
<br />
<input type = "submit">
</form>

PHP处理脚本:

$subject = $_POST['subject'];//line 7
$author = $_POST['author'];//line 8
$content = $_POST['content'];//line 9
$date = date("d/m/Y");

错误:

Notice: Undefined index: subject in E:\_temp\xampp\htdocs\sxp\insert_into.php on line 7

Notice: Undefined index: author in E:\_temp\xampp\htdocs\sxp\insert_into.php on line 8

Notice: Undefined index: content in E:\_temp\xampp\htdocs\sxp\insert_into.php on line 9

1 个答案:

答案 0 :(得分:5)

你有重复的帖子可能是什么使它起作用。尝试将表单名称更改为其他名称。此外,尽量摆脱=符号周围的额外空间。