so far I have used pure javascript to validate my form, but I need to add a mysqli query into the mix. Only I'm not so great with jquery and ajax. I can do a simple login form but this is a bit more complicated. can anyone give me any pointers on how I could add a jquery/ajax component to validate this:
foreach($_POST as $key=> $for) {
if(!empty($for) && $key != 'send' && $key != 'title') {
$usercheck = "SELECT email FROM users WHERE email = '$for'";
$usercheck = $db->query($usercheck);
if($usercheck->num_rows > 0) {$x="1"; continue;}
if($usercheck->num_rows == 0){$x="2"; break;}
}
}
if($x == "2") {$message = $for." is not a regestered email";}
if($x == "1") { // valid - submit.