Page 1 of 1

How to do the email address in php code!!

Posted: Mon Apr 19, 2004 11:47 am
by joyce
hi, how to do the email address.
I do the code already, but when i run the guestbook look like nothing happen like that.
Can you please help me to see the coding?
Thankx ^_^

Code: Select all

$errmsg = "" ;
if ($email != "")
{
     $errmsg = htmlentities($email);
     $email_checker = explode("@", $email);
     if (!IsSet($email_checker[1]))
     {
          $errmsg = "$email doesn't look like a valid email address";
     }
     else
     {
          //email checked
     }
}
[Edit: Added PHP tags fror eyecandy. --JAM]

Posted: Wed May 12, 2004 12:59 pm
by kendall
Joyce,

Uhm...honey....can you be a lil more specific how about posting the isSet! code....

Try searching the forum for email address validation rules their shud be a topic that can solve your problem

KEndall

Posted: Wed May 12, 2004 1:06 pm
by magicrobotmonkey
i think she's going for isset()

Posted: Wed May 12, 2004 2:02 pm
by kendall
magic,

oops....sorry

Posted: Wed May 12, 2004 2:17 pm
by patrikG
The only thing you're doing with this script, joyce, is to see whether there is anything behind the @. A totally invalid email like "patrikG@" would be validated with your script - so, unfortunately, the script is very useless.

There are plenty of ready-made scripts out there using regular expressions like this.
You don't have to wrap your head around that regular expression - regEx are one of those quite abstract and devilish things that look like someone rolled an armadillo over the keyboard. However, they are are extremely powerful and can aid you in so many ways.