The notice needs to be in the same block as the exit command - after all, you only want to tell them "something went wrong" if something went wrong.
I would suggest something more useful than "Please go back" - send them to an actual error page, for example, or show them the form again (with error message(s) included). It's a little more complicated to set up, but it's a lot nicer for all concerned.PHP Code:$userEmail = filter_var( $_POST['email'],FILTER_VALIDATE_EMAIL );
if( ! $userEmail ){
// something went wrong.
// tell the user.
echo 'Were sorry, something went wrong.
Please go back.';
// make the script end here.
exit;
}
For example:PHP Code:if( ! $userEmail ){
header( "Location: http://example.com/contact-page-with-error-message.php" );
exit;
}

