The forums have permanently moved to
forum.kirupa.com. This forum will be kept around in read-only mode for
archival purposes. To learn how to continue using your existing account on the new forums,
check out
this thread.

PHP Form by using validation and security

Hey all,
Before I state my problem, I would like to tell you want i'm doing. First of all i built a form for the users to enter their name, email, etc with security and form validation. Everything is working good because i receive the date to my email. However when a user just his or her name the system doesn't return the appropriate error. Example 'You forgot to enter your email.' To be more specific, the form doesn't validates.
Here is the code:

The way you're formatting your code makes it really hard to follow. If I'm reading this correctly, it would appear the execution never reaches the part where it says "You forgot to enter your email." if the user doesn't enter his email.

If the user didn't supply his email, this would fail:

PHP Code:

if ( preg_match($emailPattern, $_POST['email'] )) {

and it would never reach this because it is nested within the if conditional above: