Simple Email Validation
Starting with PHP 5.2.0 there is a really easy way to validate email addresses – namely the filter_input function. The example below takes a submitted POST variable called ‘email’, validates it against the email format, and returns FALSE if the filter fails or the value of the variable on success.
- $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
Thats all there is to it.
0 Comments