Hello,
I was wondering...
I have a form which gets submitted by customers. The form points to a PHP script which then processes the form.
What is the easiest /cleanest way to check that the required fields have been entered BEFORE processing the form?
I was doing something like this, but for some reason it always fails:
//Check for required fields
if ( '$_POST[name]' == '' || '$_POST[name2]' == '' || '$_POST[address]' == '' || '$_POST[city]' == '' || '$_POST[state]' == '' || '$_POST[zip]' == '' || '$_POST[p1]' == '' || '$_POST[p1b]' == '' || '$_POST[p1c]' == '' || '$_POST[preference]' == '' || '$_POST[question_1]' == '' || '$_POST[question_2]' == '' || '$_POST[question_3]' == '' || '$_POST[question_4]' == '' || '$_POST[value]' == '' || '$_POST[owe]' == '' || '$_POST[interest]' == '' || '$_POST[monthly]' == '' || '$_POST[annual_income]' == '' || '$_POST[cash_out]' == '' || '$_POST[new_loan]' == '' );
{
echo "<br><table width='60%' cellpadding=0 cellspacing=0 align='center'><td align='center'>You're missing fields! Please fill in every field marked with a asterisk <font color='#FF0000'>*</font><br><br>Please hit your <b>BACK</b> button and fill in all the necessary fields!<br><br>Thank You.</td></table>";
die();
}
Any coding examples are greatly appreciated!!! Thanks!