Is there a way that i can just click the button on the form, and instead of opening up a new small window, the button will just check the username that the user has typed into the username field on the form. This will save the user having to type the username into the new window again when it opens.
Here is the code that the small window performs for checking the username
Code: Select all
$username = mysql_real_escape_string($_POST['username']);
$check = mysql_query("SELECT username FROM accounts WHERE username = '$username'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
echo(sorry, username is in use);
}
else
{
echo(username is available);
}