Código PHP:
Dependencia:<select name='cod_dep'>
<option value=" "selected></option>
<?
$sql3 = "select * from dependencias order by cod_dep";
$result3 = mysql_query ($sql3, $link);
while ($row = mysql_fetch_array ($result3)) {
$mcodpr = $row['cod_dep'];
$mprog = $row['dtalle_dep'];
if ($pro == $mcodas)
echo "<option value= '$mcodpr'> $mprog </option>";
else
echo "<option value= '$mcodpr'> $mprog</option>";
}
echo "</option>";
?>
</select>
//input donde quiero que aparezca el codigo de la dependencia
echo "<input type='text' name='cod_dep' value='$row->cod_dep' ";