Re: validating using php
| From: | Iv Ray | Date: | Wed, 14 May 2008 13:26:35 +0000 |
| Subject: | Re: validating using php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274305@lists.php.net to get a copy of this message | ||
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