How to get city under country in auto complete search using jQuery and PHP
<p>This is html my code</p>

<pre><code>&lt;input type="text" name="country" id="country"/&gt;
&lt;input type="text" name="city" id="city"/&gt;
</code></pre>

<p>This is my jquery code</p>

<pre><code>$(document).ready(function() {

$('#country').keydown(function(){
    $(this).autocomplete({
        source: "get_country.php",
        minLength: 0,
        autoFocus: true,
        select: function(event, ui)
        {

        }
    });
});

var country = $("#country").val(); 

$('#city').keydown(function(){
    $(this).autocomplete({
        source: "get_city.php",
        //type:"GET",
        data : 'country='+country,
        minLength: 0,
        autoFocus: true,
        select: function(event, ui)
        {

        }
    });
});

});
</code></pre>

<p>This is my code get_city.php</p>

<pre><code>include_once('config.php');

if ( !isset($_REQUEST['term']) )
exit;

$country = $_POST['country'];

$rs = mysql_query('select city from xyz_table where country="$country" and city like "'. mysql_real_escape_string($_REQUEST['term']) .'%" order by city asc limit 0,10');

$data = array();
if ( $rs &amp;&amp; mysql_num_rows($rs) )
{
while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) )
{
    $data[] = array(
        'value' =&gt; $row['city']
    );
}
}

echo json_encode($data);
flush();
</code></pre>

<p>here is showed below problem <b>Notice</b>: Undefined index: country in <b>G:\xampp\htdocs\xyz\get_city.php</b> on line <b>6</b></p>

<p>I have get country in  auto complete search  such as Germany , United Kingdom </p>

<p>I want to get auto complete search city under country (for example Germany/United Kingdom)</p>

<p>How can i solve it , Please any suggestion </p>
