Validating email form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greg92
Forum Newbie
Posts: 3
Joined: Sat Jan 15, 2005 1:57 am

Validating email form

Post 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 :?: :?:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply