表单传递无法接收的问题分析

本文记录了一次因拼写错误导致表单数据无法被正确接收的问题排查经历。作者通过检查发现表单method属性拼写错误,并成功修复了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

写了一个表单传递的小程序,但是处理文件却无法接收到了表单数据,花了好久,把所有的代码都看了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;

?>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值