Page 1 of 1

Validating email form

Posted: Sat Jan 15, 2005 2:28 am
by greg92
I am a newbie at PHP. I am creating a villa rental site, I have a made a booking form and want to send the information from the booking form to the owners email address as well as a thank you email to the sender.
I am also trying to validate the form input. I have done this to a certain degree and get an error msg for an empty or invalid field ok, but at the same time incomplete booking form information email is sent.

How do I stop the form information been sent, before it has been validated :?: :?:

Posted: Sat Jan 15, 2005 9:00 am
by feyd
use a common (to all the fields) flag that says there's an error.. gather up all the error information into a seperate variable. After the validation section, check the flag, if it says there's an error, output the error information (suggest with the form prefilled with the valid data.) Stop processing the script, so the emails aren't sent.