I have a form that users can add user information into the database. I have some javascript that checks to make sure that all of the values have been entered before they are submitted, but I would like to take it one step farther. I would also like it to be able to look and see if the users email address is already in the database before the form data is entered. This would involve accessing mysql through javascript. I am at a loss as to how to go about and do this so I was wondering if someone would be able to point me in the right direction. Here is the validation code so far.
function checkInputs (form) {
if (form.userName.value == ""
{
alert ("You must provide a username!"
;
form.userName.focus ();
return false;
}
if (form.password.value != form.pass_verify.value) {
alert ("Your passwords do not match!"
;
form.password.focus ();
return false;
}
if (form.email.value == ""
{
alert ("You forgot to enter your email address!"
;
form.userName.focus ();
return false;
}
if (form.fullName.value == ""
{
alert ("You forgot to enter your Full Name!"
;
form.password.focus ();
return false;
}
return true;
}
function checkInputs (form) {
if (form.userName.value == ""
alert ("You must provide a username!"
form.userName.focus ();
return false;
}
if (form.password.value != form.pass_verify.value) {
alert ("Your passwords do not match!"
form.password.focus ();
return false;
}
if (form.email.value == ""
alert ("You forgot to enter your email address!"
form.userName.focus ();
return false;
}
if (form.fullName.value == ""
alert ("You forgot to enter your Full Name!"
form.password.focus ();
return false;
}
return true;
}