php newbie
I have a form which has a shed load of fields that are compulsory, but can’t figure out a neat way of coding the error message…
"These fields are blank
field1
field7
field 11 etc"
I can do it for each individual field but don’t want to repeat the same error message for each field, and can’t figure out where the loops/if {} should go.
Any help appreciated - my current messy code is
if ($forename == “” | $surname == “” | $address == “” | $landline == “” | $email == “” | $ni == “” | $licence == “” |
$car == “” | $dob == “” | $age == “” | $marital == “” | $height == “” | $weight == “” | $eyes == “” | $badge == “” |
$bnumber == “” | $bexpiry == “” | $sortcode == “” | $account == “” | $bankname == “” | $holder == “” | $emergencyname == “” |
$emergencyphone == “” | $relation == “” | $offences == “” | $ref1name == “” | $ref1address == “” | $ref1phone == “” |
$ref2name == “” | $ref2address == “” | $ref2phone == “” | $bankrupt == “” | $judgements == “” | $school1name == “” |
$school1address == “” | $school1dates == “” | $school1contact == “” | $illness == “” | $vision == “” | $glasses == “” |
$hearing == “” | $smell == “” | $signature == “” | $sigdate == “” | $refs == “” | $refsdate == “”) {
echo “
All required questions have not been answered.
Please click back on your browser to check your application and complete the missing information
before re-submitting.
}