+---------+------------+
| class | name |
+---------+------------+
| 10021 | John |
| 10027 | Alex |
| 10030 | Brian |
| 10033 | Anita |
+---------+------------+
textfield
当我从组合框中选择一个菜单时,我正在尝试同步我的:
<?
$cn=mysql_connect("localhost","root") or die("Note: " . mysql_error());
$res=mysql_select_db("psi",$cn) or die("Note: " . mysql_error());
$sql = "select name, class from list;";
$res=mysql_query($sql) or die("Note: " . mysql_error());
?>
<select name="names">
<?
while($ri = mysql_fetch_array($res))
{
//this comboBox works well
echo "<option value=" .$ri['name'] . ">" . $ri['name'] . "</option>";
}
echo "</select> ";
echo "Class :";
echo "<input disabled type='text' value=".$ri['class'].">". $ri['class'] . "</input>";
?>
例如,当我Alex
从组合框中选择时,我textfield
应该显示带有 value 的字段10027
。