Re: Form Validation

From: Date: Tue, 08 Aug 2000 14:31:26 +0000
Subject: Re: Form Validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10665@lists.php.net to get a copy of this message
To check email, you can use a function like this: function validateEmail($email) { if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.(com|net|edu|org|mil))$",$ email)){ return 1; } else { return 0; } } To check the others, you'll want to read up on regular expressions. These will be pretty trivial expressions. Nothing complicated at all... ----- Original Message ----- From: "Sid" <cyco_sid@phreaker.net> To: <php-general@lists.php.net> Sent: Tuesday, August 08, 2000 7:40 AM Subject: [PHP] Form Validation > I need to validate a form in PHP. Here are the things I have a prob with. > Checking if a field has only letters. > Checking if a field has only numbers > Checking if a field contails a valid e-mail address like someone@somthing.com > Checking if a field does not have any special charecters like ~!@#%$^*() > > I also want to thank everyone who answered my question of how to convert > lower case to upper case. > > SID > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#10665) next »