0

my index page

<script type="text/javascript">
$(document).ready(function(){
$("#first_name").blur(function() {
var first_name = $('#first_name').val();
var fathermobile = $('#fathermobile').val();
if(first_name=="")
{
$("#disp").html("");
}
else
{
$.ajax({
type: "POST",
url: "detail.php",
data: 'first_name='+ first_name +'fathermobile='+fathermobile,
success: function(html){
$("#disp").html(html);

}
});
return false;
}
});
});

and my detail.php

<?php
include("include/connect.php");  
if(isset($_POST['first_name']) && isset($_POST['fathermobile']) )
{


$first_name=mysql_real_escape_string($_POST['first_name']);
$fathermobile=mysql_real_escape_string($_POST['fathermobile']);
$query=mysql_query("select * from  candidate where  first_name='$first_name'");
$row=mysql_num_rows($query);
if($row==0)
{
echo "<span style='color:green;'>Please Continue..</span>";
}
else
{
echo "<span style='color:red;'>Already Registered</span>";

}
}

?>

Please help me i am not getting data with multiple varibles in detail page

2
Contributors
2
Replies
6
Views
2 Years
Discussion Span
Last Post by ramsiva
1

The 'data' string parameter doesn't look right:

data: 'first_name='+ first_name +'fathermobile='+fathermobile,

Try

data: 'first_name=' + first_name + '&fathermobile=' + fathermobile,    

Alternatively...

data: {first_name: first_name, fathermobile: fathermobile},
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.