+---------+------------+
| class | name |
+---------+------------+
| 10021 | John |
| 10027 | Alex |
| 10030 | Brian |
| 10033 | Anita |
+---------+------------+
我想要同步我textfield,当我从ComboBox中选择其中一个菜单:同步组合框HTML文本框与
$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());
?>
while($ri = mysql_fetch_array($res))
{
//this comboBox works well
echo "" . $ri['name'] . "";
}
echo " ";
echo "Class :";
echo "". $ri['class'] . "";
?>
例如,当我从下拉框中选择Alex,我textfield应显示值为10027的字段。
2012-12-29
andrian
+0
你的意思是什么?你想同时选择Box/10021和John的值和文本在文本框中解决? –
+0
你几乎明白我的意思,当我从comboBox中选择“Alex”时,textfield直接显示“10027”,因为该字段与表格相关。 –
+0
你有没有试过下面的答案? –