How to do the email address in php code!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joyce
Forum Newbie
Posts: 6
Joined: Fri Apr 16, 2004 1:02 am

How to do the email address in php code!!

Post 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]
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post 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
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

i think she's going for isset()
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

magic,

oops....sorry
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post 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.
Post Reply