有人可以向我解释一下吗?
我有以下代码:
<form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" id="testField" /> <input type="submit"> </form> <br /><br /> <pre> <?PHP print_r($_POST); ?> </pre>
这在我的主开发盒和服务器上工作正常.但是,我现在不得不在我的笔记本电脑上远程工作.我安装了与我的开发设置完全相同的WAMPServer 2.1a版本,$_POST数组为空.
如果我声明这样的字段:
<input type="text" name="testField" />
我得到了预期的输出.
从HTML 4.01规范,§17.2,“Controls”:
原文链接:https://www.f2er.com/php/133707.htmlA control’s “control name” is given by its name attribute.
…
When a form is submitted for processing,some controls have their name paired with their current value and these pairs are submitted with the form.
“id”并不重要.