[英]nothing happens when clicking on my submit button no _POST values
由于某些原因,当用户单击我的提交按钮时,什么也不会发生。 html看起来像这样:
<td colspan="3">
<div align="center">
<input name="Decline" id="Decline" value="Decline" type="submit">
|
<input name="Accept" value="Accept" type="submit">
</div><input name="place" value="user1" type="hidden"><input name="id" value="1" type="hidden">
</td>
我使用php从我的数据库中获取此html代码。 它是我网站上消息系统的一部分,用户可以在其中向其他用户发送消息,并接受和拒绝来自其他用户的请求。 我从数据库得到这样的消息:
while($get = mysql_fetch_object($mysql1)){
echo $get->message;
当我尝试使用此信息时,$ _ POST不显示任何内容。
我用以下代码进行了测试:
if (!empty($_POST)){
echo "test"; // nothing shows up!
}
您需要将输入字段包装在FORM标记中。 尝试:
<td colspan="3">
<div align="center">
<form method="post" action="/path/to/script.php">
<input name="Decline" id="Decline" value="Decline" type="submit">
|
<input name="Accept" value="Accept" type="submit">
</div><input name="place" value="user1" type="hidden"><input name="id" value="1" type="hidden">
</form>
</td>
确保:
form
标签 POST
方法 var_dump($_POST);
打开错误检查以查看任何可能的错误:
ini_set('display_errors', true);
error_reporting(E_ALL);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.