AcidReignX
Programmer
Php.net is being entirely unhelpful in it's explanations of ereg & preg_match, but it appears that they are what I would like to have.
I am trying to create a registry form where when the user types in a username, he/she cannot enter special characters (only alpha-numeral characters allowed).
I've spent over an hour ripping my hair out testing it and reading through the php.net explanation, but everything I come up with doesn't work. Can somebody help me? This is what I tried:
if(!preg_match('([a-zA-Z0-9])', $nt_user))
{
$nt_regyes = false;
$nt_error .= "- Username may not contain special (non-alpha-numeric) characters.<br>";
}
// $nt_user is the value of the username after submitting the form.
I am trying to create a registry form where when the user types in a username, he/she cannot enter special characters (only alpha-numeral characters allowed).
I've spent over an hour ripping my hair out testing it and reading through the php.net explanation, but everything I come up with doesn't work. Can somebody help me? This is what I tried:
if(!preg_match('([a-zA-Z0-9])', $nt_user))
{
$nt_regyes = false;
$nt_error .= "- Username may not contain special (non-alpha-numeric) characters.<br>";
}
// $nt_user is the value of the username after submitting the form.