Top Hosting Forum

WebHosting Reviews Forum


Budget DirectAdmin hosting and domain names

PHP Form: How to check whether email is valid

Website Development is a general forum for Website Development related issues including questions on codes such as PHP, HTML and Javascript
Hosting Forum Description
Website Development is a general forum for Website Development related issues including questions on codes such as PHP, HTML and Javascript

PHP Form: How to check whether email is valid

Postby hostingforum » Sun Apr 15, 2012 9:17 pm

Hi there, this is good example how submitted email can be checked whether is valid.
This code check whether submitted string contains proper characters

Code: Select all
$pattern = '~[a-zA-Z0-9-_.]+@[a-zA-Z]+\.[a-z]{2,4}~i';
$subject = 'example.test@example.com';
if(preg_match($pattern,$subject)){ //if TRUE, a match has been found
      print "valid email";
}else{
      print "invalid email";
}



Ad: There You can have your forum site-wide banner/text ad for $99 yearly. Contact admin


User avatar
hostingforum
Site Admin
 
Posts: 656
Joined: Fri May 20, 2011 7:58 pm
Location: Czech Republic

Return to General Website Development & Programming

Who is online

Users browsing this forum: No registered users and 0 guests

.

cron