不知道为什么会这样,但我的简单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>
Run Code Online (Sandbox Code Playgroud)
PHP处理脚本:
$subject = $_POST['subject'];//line 7
$author = $_POST['author'];//line 8
$content = $_POST['content'];//line 9
$date = date("d/m/Y");
Run Code Online (Sandbox Code Playgroud)
错误:
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
Run Code Online (Sandbox Code Playgroud)