Jump to content

how can i check characters using Ereg()


dharm

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.