area2.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. $area1id=intval($_GET[area1id]);
  5. $area2id=intval($_GET[area2id]);
  6. if($area1id!=""){$ses1=" and parentid='".$area1id."'";}
  7. if($area2id!=""){$ses2=" and parentid='".$area2id."'";}else{$ses2=" and id=0";}
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="x-ua-compatible" content="ie=7" />
  13. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  14. <title>选择市</title>
  15. <style type="text/css">
  16. body{margin:0;font-size:12px;}
  17. p{margin:2pt 0 0 0;}
  18. *{margin:0 auto;padding:0;}
  19. ul{list-style-type:none;margin:0;padding:0;}
  20. .inp{float:left;border:#CCCCCC solid 1px;height:31px;padding:0 0 0 5px;margin-right:7px;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}
  21. </style>
  22. <script language="javascript">
  23. function area2cha(){
  24. location.href="area2.php?area1id=<?=$_GET[area1id]?>&area2id="+document.getElementById("area2").value;
  25. }
  26. function area3cha(){
  27. parent.document.f1.add2.value=document.getElementById("area2").value;
  28. parent.document.f1.add3.value=document.getElementById("area3").value;
  29. }
  30. </script>
  31. </head>
  32. <body>
  33. <!--begin-->
  34. <select name="area2" class="inp" id="area2" onchange="area2cha()">
  35. <option value="0">请选择</option>
  36. <? while1("*","yjcode_city where level=2".$ses1." order by xh asc");while($row1=mysql_fetch_array($res1)){?>
  37. <option value="<?=$row1[bh]?>"<? if($row1[bh]==$_GET[area2id]){?> selected="selected"<? }?>><?=$row1[name1]?></option>
  38. <? }?>
  39. </select>
  40. <select name="area3" class="inp" id="area3" onchange="area3cha()">
  41. <option value="0">请选择</option>
  42. <? while2("*","yjcode_city where level=3".$ses2." order by xh asc");while($row2=mysql_fetch_array($res2)){?>
  43. <option value="<?=$row2[bh]?>"<? if($row2[bh]==$_GET[area3id]){?> selected="selected"<? }?>><?=$row2[name1]?></option>
  44. <? }?>
  45. </select>
  46. <!--end-->
  47. <script language="javascript">
  48. area3cha();
  49. </script>
  50. </body>
  51. </html>