3

真的不知道为什么会这样,但我的简单 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
4

1 回答 1

5

你有重复的帖子可能是它起作用的原因。尝试将您的表单名称更改为其他名称。另外,尝试去掉 = 符号周围的多余空格。

于 2013-03-19T21:12:52.337 回答