Ereg problem
| From: | Beauford | Date: | Tue, 27 Jun 2006 16:14:00 +0000 |
| Subject: | Ereg problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-238730@lists.php.net to get a copy of this message | ||
One more in my recent woes. The last elseif does not work in the code below
- even if the string is correct it always says it's incorrect. Even if I
remove everything else and just have the ereg satement is doesn't work
either.
The code below is in a function and $_POST['password1'] is passed to the
function.
$field = "password1"; //Use field name for password
if(!$subpass){
$form->setError($field, " Password not entered");
}
elseif(strlen($subpass) < 6) {
$form->setError($field, " Too Short");
}
elseif(strlen($subpass) > 10) {
$form->setError($field, " Too Long");
}
elseif(!ereg('[^A-Za-z0-9]', trim($subpass))) {
$form->setError($field, " Not alphanumeric");
}
Thanks
B