Autocomplete text input in reference to the value of another text input
<p>I have two fields, one of which has the <a href="http://www.mix26.com/demo/ajax-autocomplete/test.php" rel="nofollow">jQuery autoComplete plugin</a>.</p>

<pre><code>&lt;input type='text' name='primary_diagnosis' id='icd1-diagnosis'/&gt;
&lt;input type='text' name='ICD_No1' id='icd1-num' /&gt;

$(document).ready(function(){
    $("#icd1-diagnosis").autocomplete("autocomplete-icd.php", 
    {
        selectFirst: true
    });
});
</code></pre>

<p>Is there a way to automatically fill up the second text input once a value has been selected for the first? For example, selecting "Dengue fever [classical dengue]" for the first text input, then query the database for certain value to yeild "A90" as the value for the second text input.</p>

<p>Here's autocomplete-icd.php</p>

<pre><code>&lt;?php
    include('config.php');
    $q=$_GET['q'];
    $my_data=$q;

    $sql=mysql_query("SELECT col9 FROM tb_data_icd WHERE col9 LIKE '%$my_data%' ORDER BY col9",$con);
    if($sql)
    {
        while($row=mysql_fetch_array($sql))
        {
            $col9=$row['col9'];
            echo "$col9"."\n";
        }
    } 
?&gt;
</code></pre>
