LearningCoder
11-12-2012, 01:51 AM
Hello,
I am starting to validate my form post data and wondered if there is anyway I can get around using the ctype_alpha() function in allowing a space to be entered in that given string?
I need to be able to let the user enter a space in the 'name' field in-case they try entering their surname.
Do I need to manually search, do something like:
$characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
//search each position in the input string, if at any time it doesn't contain
//something in the above string, do error. if it does always contain
//a value from the above string, we know its ok?
Thank you for your thoughts.
Kind regards,
LC.
I am starting to validate my form post data and wondered if there is anyway I can get around using the ctype_alpha() function in allowing a space to be entered in that given string?
I need to be able to let the user enter a space in the 'name' field in-case they try entering their surname.
Do I need to manually search, do something like:
$characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
//search each position in the input string, if at any time it doesn't contain
//something in the above string, do error. if it does always contain
//a value from the above string, we know its ok?
Thank you for your thoughts.
Kind regards,
LC.