試圖學習PHP與測試和嘗試方法我掙扎着isset()。 這裏是我的代碼有:問題與Isset()函數
<form action="validate.php" method="POST">
<label title="User Input"> Custom Header Name</label>
<input type="text" name="user_input">
<button type="submit" id="pageName">Submit</button>
</form>
和PHP文件是
<?php
if(isset($_POST['user_input']))
{
echo "Input Is Set";
} else{
echo "Not Yet Set";
}
?>
我這兩種情況下(空或填充輸入),我得到的第一個消息「輸入設置」的結果! 你能讓我知道爲什麼會發生這種情況嗎?
很確定這是因爲即使它沒有填寫它仍然發送user_input的空白帖子。 isset只檢查是否存在內容。 – lemondrop
Hola lemondrop,但我測試了像$ name這樣的litral php變量的isset()函數;它工作得很好如何不在這裏工作 –
只需檢查他們有什麼你需要的答案。 – lemondrop