networkthis Posted May 5, 2008 Share Posted May 5, 2008 Here is what I have so far.......I am trying to make sure that the user enters a valid name for a form. I am going about it this way to display an error on the form is the user tries to enter invalid characters and to let them know that only letters are allowed in the form. I have everything working great, but when you enter in blank spaces, it will display my error message saying that only letters are allowed in this field. I guess I just need to know how to allow blank spaces. Any help is greatly appreciated! function validate_ABC($text){ if (preg_match("/[^a-zA-Z]/",$text)) { $valid_ABC = 0; } else { $valid_ABC = 1; } return $valid_ABC; } Link to comment https://forums.phpfreaks.com/topic/104158-solved-help-with-matching-in-php/ Share on other sites More sharing options...
networkthis Posted May 5, 2008 Author Share Posted May 5, 2008 Never mind I figured it out!!!! [:blank:] needed to add this in to the reg exp. I kept trying it as :blank: Link to comment https://forums.phpfreaks.com/topic/104158-solved-help-with-matching-in-php/#findComment-533244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.