/ Published in: PHP
A generic loop-based form validation to check which _POST value is empty.
Enter the form name in Line 3 and put the description in Line 4.
Enter the form name in Line 3 and put the description in Line 4.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//---- validation ------ // $count = 0; //check all required forms foreach($required_fields as $fields) { if ($_POST[$fields] == "") $error_check .= "You need to enter field '".$required_fields_description[$count]."'. Go back. <br />"; $count++; } //----- end validation ------//