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! 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? 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! 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
Archived
This topic is now archived and is closed to further replies.