web_master Posted July 14, 2008 Share Posted July 14, 2008 hi, Ive made a site where people can register. how can they use only simple letters for a "nick" (no é, á, ö or others)? have You some script for that? thnxs Link to comment https://forums.phpfreaks.com/topic/114604-solved-quotnickquot-to-be-a-simple-letters/ Share on other sites More sharing options...
Lodius2000 Posted July 14, 2008 Share Posted July 14, 2008 what you need is a regular expression combine with a preg function if you want to make the user reenter the name until it contains only "simple letters" use preg_match('/^[a-zA-Z]+$/i', $variable_contains_user_input) combined with an if() statement, like if(!preg_match('/^[a-zA-Z]+$/i', $variable_contains_user_input)){ redisplay form and tell the user what is wrong } that is what I do Link to comment https://forums.phpfreaks.com/topic/114604-solved-quotnickquot-to-be-a-simple-letters/#findComment-589242 Share on other sites More sharing options...
LooieENG Posted July 14, 2008 Share Posted July 14, 2008 for letters only <?php if ( ctype_alpha($_POST['username']) ) { // user has a name containing letters only } ?> and for letters and numbers <?php if ( ctype_alnum($_POST['username']) ) { // user has a name containing letters and numbers only } ?> Link to comment https://forums.phpfreaks.com/topic/114604-solved-quotnickquot-to-be-a-simple-letters/#findComment-589245 Share on other sites More sharing options...
web_master Posted July 14, 2008 Author Share Posted July 14, 2008 THANXS, ist work! Link to comment https://forums.phpfreaks.com/topic/114604-solved-quotnickquot-to-be-a-simple-letters/#findComment-589250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.