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