Hello again. I have one final question.
If my visitors miss a field that is required, how do I set my page up to show the missing fields? For example, if the phone or email is required, how do I let them know that it is the phone or email that is missing.
The current code that let’s them know that they have missed a field is as follows:
// check input, if any required fields are empty the show error page
if ( empty($firstname) ||
empty($lastname) ||
( $prefer == “email” && empty($email) ) ||
( $prefer == “phone” && empty($phone) ) )
{
header(“Location: “. ERROR);
exit;
}
I want my missing page to reflect the missing fields. Is there a different code?
Also, while searching for the answer to my above question, I ran across this code used to validate the email address:
// check client email address
if (preg_match(“/^w+@w+.[a-z]{2,}(.[a-z]{2,})?$/i”, $_POST[‘clientEmail’])) {
echo “Address is valid”;
}
else {
echo “Address is invalid”;
}
Can I use this below the code for the error fields?
I would like to one day make it where the error messages will appear on the same page as the form, but atlas, I’m not quite that advanced.
Thanks again for your help.
Magikey.