Re: [PHP] validating using php
- Date: Wed, 14 May 2008 15:26:35 +0200
- From: Iv Ray <pobox@xxxxxxxxxxxxx>
- Subject: Re: [PHP] validating using php
Sudhakar wrote:
> if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) )
> {
> $error.="Name is blank or has special characters ";
> }
You have messed up the brackets. This -
strlen(trim($name) == 0 )
should be -
strlen(trim($name)) == 0
Then the script does what you want.
Iv
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php