通过POST发送到PHP的值都是空字符串 [英] Values sent to PHP via POST are all empty strings
本文介绍了通过POST发送到PHP的值都是空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的格式如下:
<FORM action="http://url.to.mysite.com/doc.php" method="post">
<INPUT type="text" id="name">
<INPUT type="text" id="id">
<INPUT type="submit" value="Send">
</P>
</FORM>
不幸的是,无论在文本字段中键入什么内容,PHP脚本在每个$_POST
变量中仅接收空字符串.所有变量都已设置,只是空的.可能是什么原因造成的?
Unfortunately, whatever is typed into the text fields, the PHP script receives only empty strings in every $_POST
variable. All of the variables are set, just empty. What can be the cause of that?
推荐答案
您在html中缺少名称属性:
You are missing the name properties in your html:
<FORM action="http://url.to.mysite.com/doc.php" method="post">
<INPUT type="text" name="name" id="name">
<INPUT type="text" name="id" id="id">
<INPUT type="submit" value="Send">
</FORM>
这篇关于通过POST发送到PHP的值都是空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文