dharm Posted June 18, 2006 Share Posted June 18, 2006 Hi, can anyone help!.. im trying to check the characters of a username and password but cant seem to check the whole field, only the first letter. Here is the code Please tell me where im going wrong..$UserNameGood = chk_chars($username1);//}if ($UserNameGood == true) {echo "username is good";}else {echo "username is bad";} // $PassWordGood = chk_chars($password1);function chk_chars($inputVar) { $charsGood = true;if (!ereg("^[A-Za-z0-9_-]",$inputVar)){ $charsGood = false;} return $charsGood;}Thx! Quote Link to comment https://forums.phpfreaks.com/topic/12310-how-can-i-check-characters-using-ereg/ Share on other sites More sharing options...
.josh Posted June 18, 2006 Share Posted June 18, 2006 what are you trying to check them for? Quote Link to comment https://forums.phpfreaks.com/topic/12310-how-can-i-check-characters-using-ereg/#findComment-47043 Share on other sites More sharing options...
dharm Posted June 18, 2006 Author Share Posted June 18, 2006 found the problem.. i was missing +$ within (!ereg("^[A-Za-z0-9_-]+$",$inputVar)).. hehe! Quote Link to comment https://forums.phpfreaks.com/topic/12310-how-can-i-check-characters-using-ereg/#findComment-47053 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.