2010-08-17 146 views
0

由于某种原因,当用户点击我的提交按钮时没有任何反应。如下所示的html:点击我的提交按钮时没有任何反应没有_POST值

<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! 
      } 
+2

你有'

'吗? – jtbandes 2010-08-17 18:59:39

回答

3

确保:

  • 你有form标签有
  • 它设置为POST方法
  • 请与 var_dump($_POST);

打开错误检查

  • 看到任何可能的错误:

    ini_set('display_errors', true); 
    error_reporting(E_ALL); 
    
  • 3

    你需要用你输入字段的形式标记。尝试:

    <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>