/>
子页面city.php:
<scriptlanguage=”javascript”type=”text/javascript”>
functiongoto(n){
this.location.href=”city.php?sh_id=”+n;
}
</script>
<selectname=”sh”onchange=”goto(this.value)”>
<option>请选择所在省市</option>
<?php
include_once(”db.php”);
$sql=”select*fromprovinceorderbysh_idasc”;
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result)){
?>
<optionvalue=”<?echo$row[”sh_id”];?>”<?if($_GET[”sh_id”]==$row[”sh_id”]){echo'selected=”selected”‘;}?>><?echo$row[”sh_name”];?></option>
<?php
}
?>
</select>
<selectname=”city”onchange=”parent.document.getElementById('city').value=this.value”>
<option>选择你所在的城市</option>
<?php
if(!empty($_GET[”sh_id”])){
//echo“ok”;
$sql=”select*fromcitywheresh_id=”.$_GET[”sh_id”].”orderbycity_idasc”;
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result)){
?>
<optionvalue=”<?echo$row[”city_name”];?>”><?echo$row[”city_name”];?></option>
<?php
}
}
?>
</select>
