The following two files are copy to the same file, Access through the Web path index.html see, this is through the IFRAME to achieve the dynamic update, list.php current content is relatively simple, you see through the list.php database query, and then display the query results list.
Index.html
<body>
<form name="myfrm">
<select name="mlist" onchange="changes();">
<option value="0">请选择...</option>
<option value="北京">北京</option>
<option value="通化">通化</option>
</select>
<select name="slist">
</select>
<iframe id="frame" src="list.php?city=" style="display:none;"></iframe>
<script language="javascript">
function changes(){
frame.location.href = "list.php?city=" + document.myfrm.mlist.value;
}
</script>
</form>
</body>
list.php
<?php
$data = Array ("Beijing" =>array ("Xiao Qiang", "Prosperous wealth", "Xiao Qiang his father"),
"Tonghua" =>array ("Xiao Wen", "Xiao Song", "their son");
$city = $_get["City"];
$result = $data [$city];
$str = "<script language=\" javascript\ ">list = parent.document.myfrm.slist;list.length = 0;";
if ($result ==null)
$str. = "TMP = new option (\ ... \" \ "\"); list.options[0] = tmp; ";
Else
foreach ($result as $i => $value)
$str. = "TMP = new option (\" {$value}\ ", \" {$value}\ "); list.options[$i] = tmp;";
$str. = "</script>";
Echo $str;
?>