NoPHPPhD Posted October 30, 2006 Share Posted October 30, 2006 I would like to make sure that "Quantity" is > zero when this is submitted.If it is not, I would like to just redisplay the same form.What do I have to do? Probably very simple, just not searching for the right term.... :-\[code]print("<FORM>\n");print("<FORM ACTION=\"AddRecord.php\" METHOD=\"GET\">\n");print("<INPUT TYPE=\"TEXT\" NAME=\"Quantity\">\n");print("<INPUT TYPE=\"HIDDEN\" NAME=\"NBDno\" VALUE = '$pickedNBDno' >\n"); print("<SELECT NAME=\"Measure\">\n"); while($row = mysql_fetch_object($dbResult)) { print("<OPTION VALUE=\"{$row->WeightID}\""); print(">{$row->Description}\n"); } print("</SELECT>\n");print("<INPUT TYPE=\"submit\">\n"); print("</FORM>\n");[/code] Quote Link to comment Share on other sites More sharing options...
hackerkts Posted October 30, 2006 Share Posted October 30, 2006 You can try using [b]isset[/b], sorry I doesn't have the time to write out examples. Quote Link to comment Share on other sites More sharing options...
trq Posted October 30, 2006 Share Posted October 30, 2006 You could do something like....[code=php:0]if (isset($_GET['Quantity']) && $_GET['Quantity'] > 0) { // do action.}[/code]Of course this doesn't check the field until after submission (php cant), you would need to use Javascript to achieve that. Quote Link to comment Share on other sites More sharing options...
twofivethreetwo Posted October 30, 2006 Share Posted October 30, 2006 This site http://www.php-mysql-tutorial.com/form-validation-with-php.php has some info on client-side and server-side validation for forms. Might be of some help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.