I am new to PHP and am trying to write a form validation script that will check multiple fields to make sure they are not blank. I know how to check a single field with if (name) { etc... can I add all of the required fields in the parenthesis? and how do I designate which fields they need to correct if one is blank? thanks for any help
If they all need have a value then you can do this:
<?
while (list($key,$val) = each($HTTP_POST_VARS)) { if (trim($val) == "") { print "You must enter a value for $key. Please click the back button and try again."; die; } }
?>
http://zend.com/codex.php?id=662&single=1