我想驗證我的形式,我得到這個錯誤注意:在PHP(驗證)未定義指數
Notice: Undefined index: ReqQty in C:\project\user\requisition.php on line 180
這是我的代碼:
<td><label for="ReqQty">Quantity </label></td>
<td colspan="3"><input name="ReqQty" id="ReqQty" onkeypress="return numbersOnly(event)" onkeyup="ItmQty_Availability()" disabled="disabled">
<?php
$strReqQty = "";
if(!empty($_POST)){
if($_POST["ReqQty"]==NULL){ //ERROR here
echo "<font color=red>Enter the Quantity</font>";
}else{
$strReqQty = $_POST["ReqQty"];
}
}
?>
我得到了錯誤僅此輸入而輸入的一切也適用於其他
但在那之後,它不會顯示錯誤代碼「輸入數量」? – 2014-10-31 04:31:08
如果$ _POST ['ReqQty']沒有設置,請使用if(!isset($ _ POST ['ReqQty'])) – Akilan 2014-10-31 04:33:45