Re: Checking for and @ and a .
| From: | Philip J. Newman | Date: | Wed, 27 Feb 2002 19:54:21 +0000 |
| Subject: | Re: Checking for and @ and a . | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86467@lists.php.net to get a copy of this message | ||
Yo thanks this dose work. (o; haven't got to functions in the book yet
----- Original Message -----
From: "Chris Burnett" <chrisb@o2ideas.com>
To: "Philip J. Newman" <newmanpj@philipsdomain.com>;
<php-general@lists.php.net>
Sent: Thursday, February 28, 2002 8:25 AM
Subject: Re: [PHP] Checking for and @ and a .
> On 2/27/02 1:10 PM, "Philip J. Newman" <newmanpj@philipsdomain.com> wrote:
>
> > I'm trying to make an email field and I would like to check that its
valid
> > by checking for an @ and a . can someone point me in the right direction
for
> > this.
> >
> > THanks
> >
> >
> > Philip J. Newman
> > Philip's Domain - Internet Project.
> > http://www.philipsdomain.com/
> > info@philipsdomain.com
> > Phone: +64 25 6144012
> >
> >
> >
> Try this...
>
> function emailValidate ($str) {
> $reg = "^([a-zA-Z0-9._-]+)@([a-zA-Z0-9-])+(\.[a-zA-Z0-9-]+)+$";
> if (eregi($reg, $str)) {
> return true;
> }else{
> return false;
> }
> }
>
> $addy = "me@me.com";
> if (emailValidate($addy)) {
> echo "valid";
> }else{
> echo "Not Valid!";
> }
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>