Jump to content
Sign in to follow this  
ashishrathore

VALIDATION of EMAIL-Address without JS

Recommended Posts

hi,i know the validation of an email-id using JAVAScriptbut right now i am in a circumstances in which i have to validate email-id inside a php page using PHP code (and not the JAVASCRIPT)..can u help me in that plz?-ashish

Share this post


Link to post
Share on other sites

I am not sure if this is what you are looking for but ooh wellthere it goes

$status = "OK";  $msg=""if (!stristr($em,"@") OR !stristr($em,".")) {$msg="Your email address is not correct<BR>";$status= "NOTOK";}  if($status=="OK"){ echo "your submitted email address is $The email variable if you need it<br>";    $link = mysql_connect(" l", " ", " ");// incase you are using sql   mysql_select_db("table_name");      $sql = "INSERT INTO table_name VALUES (' ')";$query=mysql_query($sql);   echo "<center><b>THANK YOU</b> </center><br>";   echo "<center>WE HAVE YOUR EMAIL ADDRESS<br>";   }       else {echo "<center>$msg </center>";  include '/inc/go_back.inc'; //html file showing a link to try again}?>  </body></html>

I HOPE I HELPED

Share this post


Link to post
Share on other sites

try this

<?phpfunction checkEmail($email) {  $pattern = "/^[A-z0-9\._-]+"         . "@"         . "[A-z0-9][A-z0-9-]*"         . "(\.[A-z0-9_-]+)*"         . "\.([A-z]{2,6})$/";  return preg_match ($pattern, $email);}if(checkEmail($your_email_address_to_be_validate)){	echo "Correct Email";}else{	echo "You have entered invalid email address";}?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...