Advertisement
Bedhoel

ajax.php

Sep 28th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1. <?php
  2. //General Controller
  3. include "General_Controller.php";
  4. $gen_controller  = new General_Controller();
  5.  
  6. //Model Global
  7. include "model/General_Model.php";
  8. $gen_model      = new General_Model();
  9.  
  10. //Model Ajax
  11. include "model/ajax.php";
  12. $gen_ajax      = new Ajax();
  13.  
  14. $act="";
  15. if(isset($_GET['do_act'])){
  16.     $act = $_GET['do_act'];
  17. }
  18.  
  19. $id_parameter="";
  20. if(isset($_GET['id_parameter'])){
  21.         $id_parameter =$_GET['id_parameter'];
  22. }
  23.  
  24. if($act=="" or $act==null) {
  25.   echo "404 Not Found";
  26. }
  27. else if($act=="getkabkot"){
  28.             //echo '<option value="">Pilih Kota / Kabupaten </option>';
  29.             echo "<tr>
  30.                     <th>ID Kabkot</th>
  31.                     <th>Nama Kabkot</th>
  32.                  </tr>";
  33.             $where_data = array();
  34.             $where_data['province_id']  = $_POST['id_prov'];
  35.             $data_kabkot = $gen_model->GetWhere('regencies',$where_data);
  36.                 while($list = $data_kabkot->FetchRow()){
  37.                     foreach($list as $key=>$val){
  38.                     $key=strtolower($key);
  39.                     $$key=$val;
  40.                   }  
  41.                 echo "<tr>";
  42.                     echo "<td>".$id."</td><td>".$name."</td>";
  43.                 echo "</tr>";
  44.          }
  45. }
  46. else if($act=="getkecamatan"){
  47.             echo '<option value="">Pilih Kecamatan</option>';
  48.             $where_data = array();
  49.             $where_data['regency_id']  = $_POST['id_kabkot'];
  50.             $data_kecamatan = $gen_model->GetWhere('districts',$where_data);
  51.                 while($list = $data_kecamatan->FetchRow()){
  52.                     foreach($list as $key=>$val){
  53.                     $key=strtolower($key);
  54.                     $$key=$val;
  55.                   }  ?>
  56.                 <option value="<?php echo $id ?>"><?php echo $name ?></option>
  57.         <?php }
  58. }
  59. else if($act=="getkelurahan"){
  60.             echo '<option value="">Pilih Kelurahan</option>';
  61.             $where_data = array();
  62.             $where_data['district_id']  = $_POST['id_kecamatan'];
  63.             $data_kelurahan = $gen_model->GetWhere('villages',$where_data);
  64.                 while($list = $data_kelurahan->FetchRow()){
  65.                     foreach($list as $key=>$val){
  66.                     $key=strtolower($key);
  67.                     $$key=$val;
  68.                   }  ?>
  69.                 <option value="<?php echo $id ?>"><?php echo $name ?></option>
  70.         <?php }
  71. }
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement