Re: validating using php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux