dropdown list value from sql in php
<p>I want to do this function in php. i have two fields, one is text box and an
other one is drop down list. Drop down list contains values from sql. When one of the value is selected from the drop down list i want the text box to be filled according to the option which is selected.</p>

<p>Following is the drop down list code,</p>

<pre><code>&lt;td&gt;Test Group ID&lt;/td&gt;
 &lt;td&gt;&lt;select id="testgroupid" name="testgroupid" style="column-width:35"&gt;
  &lt;option value="&lt;?php echo $testgroupid;?&gt;"&gt;&lt;?php echo $testgroupid;?&gt;&lt;/option&gt;
   &lt;?php 
   $x=new con();
   $x-&gt;connect();
   $retval = "select distinct(Id) from testgroupmaster";
   $sql1 = mysql_query($retval) or die (mysql_error());
   while($res=mysql_fetch_array($sql1, MYSQL_BOTH)){
    ?&gt; 
&lt;option value="&lt;?=$res['Id'];?&gt;"&gt;&lt;?=$res['Id'];?&gt;&lt;/option&gt;
&lt;?
}
?&gt;
  &lt;/select&gt;&lt;/td&gt;
</code></pre>

<p>According to the id,I want textbox to be filled, How can i do this ? Pls help friends.</p>

<pre><code>&lt;tr&gt;
&lt;td&gt;Test Group Name&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="testgroupname" id="zipsearch" value="&lt;?php echo $testgroupname; ?&gt; "&gt;&lt;/td&gt;
&lt;/tr&gt;
</code></pre>
