Hi everyone,
I am trying to validate a user registration form. User must enter letters and/or letters only.
//check username
$_POST['user_name'] = trim($_POST['user_name']);
$checkChar ='/^[a-zA-Z0-9]+$/';
if (!preg_match($checkChar, ($_POST['user_name']))); {
$error['char'] = 'Username must contain letters or numbers only';
}
When I submit the error message keeps coming up when it should not.
Any thoughts?