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 Link to comment https://forums.phpfreaks.com/topic/281533-security-issue-with-form-and-mysql/ Share on other sites More sharing options...
Strider64 Posted August 25, 2013 Share Posted August 25, 2013 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? Link to comment https://forums.phpfreaks.com/topic/281533-security-issue-with-form-and-mysql/#findComment-1446654 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. Link to comment https://forums.phpfreaks.com/topic/281533-security-issue-with-form-and-mysql/#findComment-1446680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.