查看文件: address.php
大小: 2.51 KB
类型: application/octet-stream
<?php require_once('../Connections/BEB2.php'); ?> <? $city = '宜蘭縣'; mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rot2 = "SELECT distinct(county) FROM address where 1 order by address_id"; $Rot2 = mysql_query($query_Rot2, $BEB2) or die(mysql_error()); $row_Rot2 = mysql_fetch_assoc($Rot2); $totalRows_Rot2 = mysql_num_rows($Rot2); mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rat2 = sprintf("SELECT distinct(district) FROM address where county='%s' order by district",$city); $Rat2 = mysql_query($query_Rat2, $BEB2) or die(mysql_error()); $row_Rat2 = mysql_fetch_assoc($Rat2); $totalRows_Rat2 = mysql_num_rows($Rat2); $district=$row_Rat2['district']; mysql_select_db($database_BEB2, $BEB2); // address_id county district street $query_Rbt2 = sprintf("SELECT address_id,street FROM address where county='%s' AND district='%s' order by street",$city, $district); $Rbt2 = mysql_query($query_Rbt2, $BEB2) or die(mysql_error()); $row_Rbt2 = mysql_fetch_assoc($Rbt2); $totalRows_Rbt2 = mysql_num_rows($Rbt2); ?> <select name="city" id="city" onchange="Selectcity()"> <option value=""></option> <? do { ?> <option value="<?= $row_Rot2['county']; ?>" <?= ($row_Rot2['county']==$city)?'selected="selected"':""; ?>><?= $row_Rot2['county']; ?></option> <?php } while ($row_Rot2 = mysql_fetch_assoc($Rot2)); ?> </select> <select name="district" id="district" onchange="Selectstreet();"> <? $address_name .= $row_Rat2['district'].','; do { ?> <option value="<?= $row_Rat2['district']; ?>" <?= ($row_Rat2['district']==$district)?'selected="selected"':""; ?>><?= $row_Rat2['district']; ?></option> <? } while ($row_Rat2 = mysql_fetch_assoc($Rat2)); ?> </select> <select name="street" id="street" onchange="show_id()"> <? $address_id=$row_Rbt2['address_id']; $address_name .= $row_Rbt2['street']; do { ?> <option value="<?= $row_Rbt2['address_id']; ?>" ><?= $row_Rbt2['street']; ?></option> <? } while ($row_Rbt2 = mysql_fetch_assoc($Rbt2)); ?> </select> <? mysql_free_result($Rot2); mysql_free_result($Rat2); mysql_free_result($Rbt2); ?>
保存
取消
返回文件列表