[英]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.