-1
I have the following validation for the username:
if (empty($_POST["username"])) {
$nameErr = "Username:Escolha um username.";
} else {
$uname = test_input($_POST["username"]);
$v1 = 'ok';
if (!ereg("(^[a-zA-Z0-9]+([a-zA-Z\_0-9\.-]*))$", $_POST["username"])) {
$v1 = 'ko';
$nameErr = "Username:Somente letras e números.";
}
}
This way I can successfully validate a username that contains letters or numbers or if the field is empty. But how do I validate the number of characters?
uses maxlength, the html attribute
– Gabriel Rodrigues
@Gabrielrodrigues hum.. then the guy takes away the developer’s tools, and the validation goes to space.
– Wallace Maxters
@Wallacemaxters exactly.
– Chris Born