I am trying to fill a text box from a dynamic select box and cant seem to figure it out. My goal is when the user selects a value from select box It creates a query based on the selection and fills my textbox fields. I think I need java script but I a very new at this PLEASE help here is what I have so far[code]function selectDistinct($tablename,$attributename,$dropdownname,$defaultvalue){ global $db; $sql = "SELECT DISTINCT {$attributename} FROM {$tablename}"; $resultID = $db->query($sql); echo "\n<select name=\"{$dropdownname}\">"; while($row = $resultID->fetchRow(DB_FETCHMODE_ASSOC)) { $result = $row[$attributename]; if(isset($defaultvalue)&& $result == $defaultvalue) echo "\n\t<option selected value =\"{$result}\">{$result}"; else echo "\n\t<option value =\"{$result}\">{$result}"; echo "</option>"; } echo "\n</select>"; } echo "Roles: "; selectDistinct("role","extension","roleselect","Add"); ?> <form name="form1" method="post" action= "addRole.php"> <table border="1" align=center bgcolor=#EEEEEE> <td colspan="2" bgcolor=#CCCCCC> <tr> <td>RoleName:</td> <td><input type="text" name="extension" value="<?php echo $result;?>" /></td> </tr> <tr> <td>DND</td> <td><input type="radio" name="dnd" value="on" />On<input type="radio" checked name="dnd" value="off" />Off</td> </tr> <tr> <td>Paging</td> <td><input type="radio" name="paging" value="on" />On<input type="radio" checked name="paging" value="off" />Off</td> </tr> <tr> <td>P:0</td> <td><select name="choice0"><option value="dest ">dest</option><option value="dtmf ">dtmf</option></select><input type="text" name="fkey_0"/></td> </tr> <tr> <td>P:1</td> <td><select name="choice1"><option value="dest ">dest</option><option value="dtmf ">dtmf</option></select><input type="text" name="fkey_1"/></td>[/code]