PageRenderTime 85ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/getCities.php

http://ebpls.googlecode.com/
PHP | 128 lines | 92 code | 36 blank | 0 comment | 19 complexity | e0c163be898c77b1245ea4a80a2686c1 MD5 | raw file
  1. <?php
  2. include_once("includes/variables.php");
  3. include_once("lib/multidbconnection.php");
  4. include_once "lib/ebpls.utils.php";
  5. $dbLink =Open($dbtype,$connecttype,$dbhost,$dbuser,$dbpass,$dbname);
  6. if(isset($_GET['owner_province_code']) || isset($_GET['main_office_prov'])){
  7. if ($_GET['main_office_prov']=='') {
  8. $prov = $_GET['owner_province_code'];
  9. } else {
  10. $prov = $_GET['main_office_prov'];
  11. }
  12. echo "obj.options[obj.options.length] = new Option('-Please Select City-','');\n";
  13. $resultset = mysql_query("SELECT * FROM `ebpls_city_municipality`where upper='$prov'") or die(mysql_error()."dd");
  14. while($datarow = @mysql_fetch_array($resultset))
  15. {
  16. $K = $datarow["city_municipality_code"];
  17. $V = $datarow["city_municipality_desc"];
  18. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  19. }
  20. }
  21. if(isset($_GET['owner_city_code']) || isset($_GET['business_main_offc_city_code'])){
  22. if ($_GET['business_main_offc_city_code']=='') {
  23. $prov = $_GET['owner_city_code'];
  24. } else {
  25. $prov = $_GET['business_main_offc_city_code'];
  26. }
  27. echo "obj.options[obj.options.length] = new Option('-Please Select District-','');\n";
  28. $resultset = mysql_query("SELECT * FROM ebpls_district where upper='$prov'") or die(mysql_error()."dd");
  29. while($datarow = @mysql_fetch_array($resultset))
  30. {
  31. $K = $datarow["district_code"];
  32. $V = $datarow["district_desc"];
  33. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  34. }
  35. }
  36. if(isset($_GET['owner_city_code1'])){
  37. $getzip = SelectDataWhere($dbtype,$dbLink,"ebpls_zip",
  38. "where upper = '$owner_city_code'");
  39. $owner_zip = FetchArray($dbtype,$getzip);
  40. echo "obj.options[obj.options.length] = new Option('$owner_zip[zip_desc]','$owner_zip[zip_desc]');\n";
  41. }
  42. if(isset($_GET['owner_district_code']) || isset($_GET['business_main_offc_district_code'])){
  43. if ($_GET['business_main_offc_district_code']=='') {
  44. $prov = $_GET['owner_district_code'];
  45. } else {
  46. $prov = $_GET['business_main_offc_district_code'];
  47. }
  48. echo "obj.options[obj.options.length] = new Option('-Please Select Barangay-','');\n";
  49. $resultset = mysql_query("SELECT * FROM ebpls_barangay where upper='$prov'") or die(mysql_error()."dd");
  50. while($datarow = @mysql_fetch_array($resultset))
  51. {
  52. $K = $datarow["barangay_code"];
  53. $V = $datarow["barangay_desc"];
  54. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  55. }
  56. }
  57. if(isset($_GET['owner_barangay_code']) || isset($_GET['business_main_offc_barangay_code'])){
  58. if ($_GET['business_main_offc_barangay_code']=='') {
  59. $prov = $_GET['owner_barangay_code'];
  60. } else {
  61. $prov = $_GET['business_main_offc_barangay_code'];
  62. }
  63. echo "obj.options[obj.options.length] = new Option('-Please Select Zone-','');\n";
  64. $resultset = mysql_query("SELECT * FROM ebpls_zone where upper='$prov'") or die(mysql_error()."dd");
  65. while($datarow = @mysql_fetch_array($resultset))
  66. {
  67. $K = $datarow["zone_code"];
  68. $V = $datarow["zone_desc"];
  69. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  70. }
  71. }
  72. if(isset($_GET['business_district_code'])){
  73. echo "obj.options[obj.options.length] = new Option('-Please Select Barangay-','');\n";
  74. $resultset = mysql_query("SELECT * FROM ebpls_barangay where upper='$_GET[business_district_code]'") or die(mysql_error()."dd");
  75. while($datarow = @mysql_fetch_array($resultset))
  76. {
  77. $K = $datarow["barangay_code"];
  78. $V = $datarow["barangay_desc"];
  79. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  80. }
  81. }
  82. if(isset($_GET['business_barangay_code'])){
  83. echo "obj.options[obj.options.length] = new Option('-Please Select Zone-','');\n";
  84. $resultset = mysql_query("SELECT * FROM ebpls_zone where upper='$_GET[business_barangay_code]'") or die(mysql_error()."dd");
  85. while($datarow = @mysql_fetch_array($resultset))
  86. {
  87. $K = $datarow["zone_code"];
  88. $V = $datarow["zone_desc"];
  89. echo "obj.options[obj.options.length] = new Option('$V','$K');\n";
  90. }
  91. }
  92. ?>