Re: [PHP] Checking for and @ and a .

2002-02-27 Thread Philip J. Newman

Yo thanks this dose work.  (o; haven't got to functions in the book yet

- Original Message -
From: "Chris Burnett" <[EMAIL PROTECTED]>
To: "Philip J. Newman" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]> 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/
> > [EMAIL PROTECTED]
> > 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 = "[EMAIL PROTECTED]";
> 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
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Checking for and @ and a .

2002-02-27 Thread Chris Burnett

On 2/27/02 1:10 PM, "Philip J. Newman" <[EMAIL PROTECTED]> 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/
> [EMAIL PROTECTED]
> 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 = "[EMAIL PROTECTED]";
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




RE: [PHP] Checking for and @ and a .

2002-02-27 Thread James Hallam

Use a regular expression to test the variable submitted by the form.  This
is an excerpt from my usual validation script using ereg()..  I'm sure you
can adapt this for your purposes..

if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

'@'.

'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.

'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email_address)) {

$send = "no";
}

HTH
james

-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 2:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Checking for and @ and a .


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/
[EMAIL PROTECTED]
Phone: +64 25 6144012




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php