[jQuery] jquery(VALIDATE)
I need a way to debug what is being returned when I use the REMOTE
option. I cant get the validation to give me an error class when a
duplicate is found. here is my lookup.php which works perfectly fine
when I use jquery $get to call it.
Lookup.php
<?
$noheaders = "true"; //prevents config.php from loading any header
data such a scripts and styles.
include("config.php");
$table = $_GET["table"];
$key = $_REQUEST["key"];
$value = $_REQUEST["value"];
$failmsg = (isset($_GET["failmsg"]) ? $_GET["failmsg"] : $value.": Not
Found in TABLE: ".$table." for KEY: ".$key);
$foundmsg = (isset($_GET["foundmsg"]) ? $_GET["foundmsg"] : $value.":
Found in TABLE: ".$table." for KEY: ".$key);
$sql="SELECT * FROM $table WHERE $key='$value'" ;
$result=mysql_query($sql);
if (mysql_num_rows($result) > 0) {
echo $foundmsg;
} else {echo $failmsg; };
?>
Here are my rules:
var validator = $("#myform").validate({
rules: {
username: {
required: true,
minlength: 4,
type: "GET",
remote: "lookup.php?table=members&failmsg=true&foundmsg=false"
},
password: {
required: true,
minlength: 5
},
email: {
required: true,
email: true,
type: "GET",
remote: "lookup.php?table=members&failmsg=true&foundmsg=false"
}
},
messages: {
Thanks,
Mike