PHP Form Validation Regular Expression, no symbols or numbers
- by MrEnder
Ok I am trying to get the users First Name
the form gets their name perfectly fine and posts it into a variable.
Now I am trying to do error checking
else if(!preg_match("/^[\w-]+$/", $firstNameSignup)) {
$firstNameSignupError = "Your first name cannot contain numbers or symbols, you entered " . $firstNameSignup;
$firstNameSignup = "";
}
I tried the above code and it does not like me but my if statement
if(!isset($firstNameSignup) || $firstNameSignup == "") {
$firstNameSignupError = "You must enter your first name";
}
works fine so I know that the error is in that else if statement... most likely in my regular expression
any help??? I'm totally at a loss (really new to PHP and regular expressions)
Thanks
Shelby