cturner Posted December 4, 2007 Share Posted December 4, 2007 I am trying to display an error only if the user has entered a username that is less than 6 characters. It hasn't worked for me. When I test the whole code and enter a username of 6 characters or more, it displays an error. It should only display login error when the username is less than 6 characters. So can someone please tell me how I can do this? Thanks in advance. Here is my code: if (strlen($_POST['username']) < 6) { $arrErrors['username'] = 'Login error.'; } Link to comment https://forums.phpfreaks.com/topic/80175-display-a-login-error-username-less-than-6-characters-how/ Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 Looks good, i use this and it works. Maybe verify the name in the form matches the name in the variable. if (trim (strlen($uname)) >= 6) { if (checkUnique ("users", "uname", $uname) == FALSE) { $errorList[] = 'Username Taken, please try another Username'; } } Link to comment https://forums.phpfreaks.com/topic/80175-display-a-login-error-username-less-than-6-characters-how/#findComment-406361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.