Monday 15 March 2010

html - Notice: Undefined index in php (validation) -



html - Notice: Undefined index in php (validation) -

i want validate form , got error

notice: undefined index: reqqty in c:\project\user\requisition.php on line 180

this code :

<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 quantity</font>"; }else{ $strreqqty = $_post["reqqty"]; } } ?>

i got error input type while works fine on others

use isset check if key in $_post exists

<?php $strreqqty = ""; if(!empty($_post)){ if(isset($_post["reqqty"])){ $strreqqty = $_post["reqqty"]; }else{ echo "<font color=red>enter quantity</font>"; } } ?>

php html sql-server validation

No comments:

Post a Comment