So users have been creating accounts and some includes %20, how do I get the input to only accept a-z, A-Z, and 0-9?
if ($username === null){$registrable = false; array_push($error,'Not a valid Username.');}
Can it be similar to the code above?
So users have been creating accounts and some includes %20, how do I get the input to only accept a-z, A-Z, and 0-9?
if ($username === null){$registrable = false; array_push($error,'Not a valid Username.');}
Can it be similar to the code above?
Are you using a normal text input? If so you can try using pattern="[a-zA-Z0-9-]+" on the input. If the pattern is not correct when submitting the form, users will get a message asking them to use the propper pattern.
use in php ctype_alnum
if (ctype_alnum($username)) {
echo "username is aplphanumeric!\n";
} else {
echo "The usename $username is not valid\n";
}