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