写了一个表单传递的小程序,但是处理文件却无法接收到了表单数据,花了好久,把所有的代码都看了N遍,最后才发现表单form中的method属性,把该单词写成了method,最后程序提示的错误是:
Notice: Undefined index: id in D:\xampp\htdocs\empmanage\empManage.php on line 2
Notice: Undefined index: password in D:\xampp\htdocs\empmanage\empManage.php on line 3
$id=
$password=
这段代码是:
<html>
<head>
<meta http-equiv="content-type" content="text/html,charset=utf-8"/>
<title>这是登录页面</title>
</head>
<h1>登录系统</h1>
<form action="empManage.php" method="post">
<table>
<tr><td>用户id</td><td><input type="text" name="id"/></td></tr>
<tr><td>密 码</td><td><input type="password" name="password"/></td></tr>
<tr><td><input type="submit" value="用户登录"/><input type="submit" value="重置"/></td></tr>
</table>
</form>
</html>
接收部分代码:
<?php
$id=$_POST['id'];
$password=$_POST['password'];
echo '$id='.$id."<br/>";
echo '$password='.$password;
?>