SQL PHP HTML ASP JavaScript articles and free scripts to download

FILTER_VALIDATE_EMAIL

We can check email address for validation by using FILTER_VALIDATE_EMAIL filter in PHP. Here is a sample code.
$email='userid@domain.com';

if(filter_var($email,FILTER_VALIDATE_EMAIL)){
echo " Yes validation passed ";
}else{
echo " No validation failed ";
}
In the above code in place of FILTER_VALIDATE_EMAIL we can use filter ID as 274

Validation of Email by GET method.

Whenever we receive any email address we can directly check like this ( without assigning any variable )
if(filter_var($_GET['email'],FILTER_VALIDATE_EMAIL)){
echo " Yes validation passed ";
}else{
echo " No validation failed ";
}
Inside our script before using email address we can check and assign a vaiable only if email validation is passed.
if(filter_var($_GET['email'],FILTER_VALIDATE_EMAIL)){
$email = $_GET['email'];
}else{
echo " Wrong email address ";
// stop execution or ask to re-submit
}
You can read how regular expressions is used to validate email address
Google+
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked



Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer