I have just started studying programming and I've been stuck for hours in this problem. I have a sign up form which asks for email and it should check the mysql database if the email is already registered. I am currently trying to use the remote method from the Jquery validator plugin but I can't seem to make it work.
emailcheck.php
<?php
include_once 'dbconnect.php';
$email = $_POST['CusEadd'];
$query = "SELECT CusEadd FROM customer WHERE CusEadd='$email'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if($count>0){
echo json_encode(FALSE);
}
else {
echo json_encode(TRUE);
}
?>
form-validation.js
CusEadd: {
required:true,
email:true,
remote:"emailcheck.php"
}