Page 1 of 1

form validation for international characters

Posted: Wed Oct 27, 2010 3:08 pm
by Tolga
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.

Code: Select all

if (preg_match("/[.\:\;\?\ ]/",$name)) { 
			 $hasError = true;
			 }
what should I do? is there any other function that I can use?

thanks in advance

Re: form validation for international characters

Posted: Thu Oct 28, 2010 7:42 am
by klevis miho
Use php's sanitize and validate filters.
http://php.net/manual/en/filter.filters.sanitize.php