Re: Form Validation
| From: | Daniel Convissor | Date: | Mon, 16 Oct 2000 17:33:19 +0000 |
| Subject: | Re: Form Validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20434@lists.php.net to get a copy of this message | ||
Jeff:
Jeff Lacy wrote:
>
> Hello. I have a form I am validating and I would like a little help. I can use strlen to find
> the length, but I need something that will tell me if A-Z or a-z is in the string. What function
> does this?
A quick partial answer to your question.
$name = ereg_replace("[^A-Za-z]", "", $name);
That evaluates the string $name and replaces everything that's not a standard
letter with nothing "".
Then, you can test length like this:
if ( strlen($name) ) {
echo "enter your name";
}
Enjoy,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409