<?php
require(dirname(__FILE__)."/global.php");
if($name=='area_id'){
	$query = $db->query("SELECT fid,name FROM {$pre}area ORDER BY list DESC");
	$list_area="<select name='postdb[province_id]' onChange=\"choose_where('province_id',this.options[this.selectedIndex].value)\">\r\n";
	$list_area.="<option value='0'>请选择省份</option>\r\n";
	while($rs = $db->fetch_array($query)){
		$checks=($rs[fid]==$vals)?"selected='selected'":"";
		$list_area.="<option value='$rs[fid]' $checks>$rs[name]</option>\r\n";
	}
	$list_area.="</select>\r\n";
	echo $list_area;
	exit;
}
elseif($name=='province_id'){
	$query = $db->query("SELECT fid,name FROM {$pre}city WHERE fup='$vals' ORDER BY list DESC");
	$list_area="<select name='postdb[city_id]' onChange=\"choose_where('city_id',this.options[this.selectedIndex].value)\">\r\n";
	$list_area.="<option value='0'>请选择城市</option>\r\n";
	$i=0;
	while($rs = $db->fetch_array($query)){
		$i++;
		$checks=($rs[fid]==$sonval)?"selected='selected'":"";
		$list_area.="<option value='$rs[fid]' $checks>$rs[name]</option>\r\n";
	}
	$list_area.="</select>\r\n";
	if($i>0){
		echo $list_area;
	}
	exit;
}
elseif($name=='city_id'){
	$query = $db->query("SELECT fid,name FROM {$pre}zone WHERE fup='$vals' ORDER BY list DESC");
	$list_area="<select name='postdb[zone_id]' onChange=\"choose_where('zone_id',this.options[this.selectedIndex].value)\">\r\n";
	$list_area.="<option value='0'>请选择区域</option>\r\n";
	$i=0;
	while($rs = $db->fetch_array($query)){
		$i++;
		$checks=($rs[fid]==$sonval)?"selected='selected'":"";
		$list_area.="<option value='$rs[fid]' $checks>$rs[name]</option>\r\n";
	}
	$list_area.="</select>\r\n";
	if($i>0){
		echo $list_area;
	}
	exit;
}
elseif($name=='zone_id'){
	$query = $db->query("SELECT fid,name FROM {$pre}street WHERE fup='$vals' ORDER BY list DESC");	
	$list_area="<select name='postdb[street_id]'>\r\n";
	$list_area.="<option value='0'>请选择街道</option>\r\n";
	$i=0;
	while($rs = $db->fetch_array($query)){
		$i++;
		$checks=($rs[fid]==$sonval)?"selected='selected'":"";
		$list_area.="<option value='$rs[fid]' $checks>$rs[name]</option>\r\n";
	}
	$list_area.="</select>\r\n";
	if($i>0){
		echo $list_area;
	}
	exit;
}
?>