form validation for international characters
Posted: Wed Oct 27, 2010 3:08 pm
I am trying to build a form that validates input on the name field and I want to disallow certain characters such as commas, question marks, semicolon, star, backslash etc. I know I can use preg_match and set [a-zA-Z] but when I do that international characters are not allowed anymore. I tried something below but it gives error.
what should I do? is there any other function that I can use?
thanks in advance
Code: Select all
if (preg_match("/[.\:\;\?\ ]/",$name)) {
$hasError = true;
}thanks in advance