表单提交后$ _POST为空 [英] $_POST is empty after form submission
本文介绍了表单提交后$ _POST为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在服务器上建立了这个测试页面。请告诉我为什么即使提交表单时, $ _ POST
数组也不包含任何内容。
I set up this test page up on my server. Please tell me why the $_POST
array does not contain anything even when I submit the form. I have tried this in three different browsers and nothing happens.
<?php print_r($_POST);?>
<form method="post">
<p><label>Email: </label>
<input type="text" id="login_email" />
</p>
<p><label>Password: </label>
<input type="password" id="login_password" />
</p>
<p><label>Remember Me?: </label>
<input type="checkbox" id="login_remember" />
</p>
<p>
<input type="submit" value="Login" />
</p>
</form>
我一直在写PHP多年,这从来没有发生过。这段代码有什么问题?
I have been writing PHP for years and this has never happened before. What is wrong with this code?
推荐答案
您的输入元素没有名称属性。应该是:
Your input elements do not have name attributes. Should be:
<input type="text" id="login_email" name="login_email" />
如果输入元素没有名称属性,则不会将其作为POST数据的一部分发送。
If an input element does not have a name attribute, it is not sent as part of the POST data.
这篇关于表单提交后$ _POST为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文