Javascript PHP$\u POST始终为空
难办的是,var dump($_POST)总是返回数组[0]{}PHP邮件,尽管总是成功。html端的变量是我在调试器中查看时所期望的。在寄存器_全局打开和关闭的情况下失败Javascript PHP$\u POST始终为空,javascript,php,Javascript,Php,难办的是,var dump($_POST)总是返回数组[0]{}PHP邮件,尽管总是成功。html端的变量是我在调试器中查看时所期望的。在寄存器_全局打开和关闭的情况下失败 <!-- html code (in contact.php) --> <form name="hhcform" method="POST" action="sendmail.php" onsubmit="return ValidateForm();" enctype="text/plain"&
<!-- html code (in contact.php) -->
<form name="hhcform" method="POST" action="sendmail.php" onsubmit="return ValidateForm();" enctype="text/plain">
First Name: <input type="text" name="firstname" value="" size="25">
<span id="firstnameErr" style="color:red">*</span>
<br><br>
Last Name: <input type="text" name="lastname" value="" size="25">
<span id="lastnameErr" style="color:red">*</span>
<br><br>
Email Address: <input type="text" name="emailaddress" value="" size="25">
<span id="emailErr" style="color:red">*</span>
<br><br>
Select a Topic: <span id="topicErr" style="color:red">*</span><br>
<div class="radio-block">
<input type="radio" name="topic" value="Insurance"> Accepted Insurance<br><br>
<input type="radio" name="topic" value="Hours"> Office Hours<br><br>
<input type="radio" name="topic" value="Refills"> Prescription Refills<br><br>
<input type="radio" name="topic" value="Patients"> Accepting New Patients<br><br>
<input type="radio" name="topic" value="Website"> Website Issues<br><br>
<input type="radio" name="topic" value="Other"> Other<br><br>
</div>
Comments: <span id="commentErr" style="color:red">*</span><br>
<textarea name="comments" rows="10" cols="25"></textarea><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset" onclick="ClearErrors();"><br><br>
</form>
名字:
*
姓氏:
*
电邮地址:
*
选择一个主题:*
接受保险
办公时间
处方补液
接受新患者
网站问题
其他
评论:*
PHP代码(在sendmail.PHP中)
取出
enctype="text/plain" in the form, this should fix the issue.
问题可能与您的enctype有关
enctype="text/plain"
试一试
相反,除非您有充分的理由使用text/plain。我们可以看看您的
validateForm
功能吗?我的第一个建议是使用您的devoper工具。让他们打开并提交你的表格。在sendmail.php上,您应该可以看到表单传递的请求数据。如果没有,则表示有东西阻止了表单发送数据。如果你看到了,那么服务器端的数据就会被阻塞,正如@Sean所说的,你应该使用你的开发工具来查看你的web浏览器是否首先发送数据。据我们所知,您的ValidateForm()
可能会阻止一切,而所有人都不知道enctype=“text/plain”
是不正确的。感谢所有回复。删除enctype=“text/plain”后,数组中填充了我期望的数据。问题解决了。太好了,很高兴听到这个消息!别忘了把Abhik的答案标记为正确,这样其他人在将来遇到同样的问题时就会知道该怎么办。干杯
enctype="text/plain"
enctype="multipart/form-data"