dhirajkumar41 Posted August 25, 2013 Share Posted August 25, 2013 i have created a form. in which i want user to enter his/her full name. so how to confirm that it doesnot contain numbers or other special characters other than alphabets. i want to store it in mysql database. Pls help. Thanks Quote Link to comment Share on other sites More sharing options...
Strider64 Posted August 25, 2013 Share Posted August 25, 2013 (edited) if (preg_match("/^[0-9a-zA-Z_]{5,}$/",$username) === 0) { echo 'Username must be bigger than 5 chars and contain only digits, letters and underscore'; } You could do something like the above with the digits removed from the preg_match statement? Edited August 25, 2013 by Strider64 Quote Link to comment Share on other sites More sharing options...
fastsol Posted August 25, 2013 Share Posted August 25, 2013 You could also use ctype_alpha() for only alphabet characters. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.