I have a form which has a field in it. When someone submits the form, I want the script to make sure the field contains only letters (upper or lower case is fine), numbers, and spaces.
I was told regex is able to do this but I'm not sure how.
So far I've tried things along the lines of
Code: Select all
if (preg_match_all('/\w+ +/', $_POST['form_field'])) {return true;}