Hi guys, i’m fairly new to php so excuse my naviety. I have been following a tutorial on creating a user management system but it doesn’t have the best form checking. The only thing form checking it uses is to verify if the username/email address are already in the database. I would like to modify the code so that it only allows the user pick a username that contains english characters (no numbers or characters) and that the first name and last name can’t contain characters or numbers either.
This is the code that is currently in place
[CODE]/* Let’s do some checking and ensure that the user’s email address or username
does not exist in the database */
$sql_email_check = mysql_query(“SELECT email_address FROM users WHERE email_address=’$email_address'”);
$sql_username_check = mysql_query(“SELECT username FROM users WHERE username=’$username'”);
$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);
if(($email_check > 0) || ($username_check > 0)){
echo “Please fix the following errors: <br />”;
if($email_check > 0){
echo “<strong>Your email address has already been used by another member in our database. Please submit a different Email address!<br />”;
unset($email_address);
}
if($username_check > 0){
echo “The username you have selected has already been used by another member in our database. Please choose a different Username!<br />”;
unset($username);
}
include ‘join_form.html’; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
Thanks for any forthcoming help. I’m sure its a simple enough thing to solve and it will probably be very logical for me to follow but i have no previous php experience so i’m at a bit of a loss at the moment. Thanks