Advertisement
androidmaker155

tesew

Feb 27th, 2016
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.56 KB | None | 0 0
  1. <?php
  2. include('connection.php');
  3.  
  4. $loadType=$_POST['loadType'];
  5. $loadId=$_POST['loadId'];
  6.  
  7. if($loadType=="kabupaten"){
  8.     $sql="select id,nama_kabupaten from kabupaten where id_provinsi='".$loadId."' order by nama_kabupaten asc";
  9. }else{
  10.     $sql="select id,nama_kecamatan from kecamatan where id_kabupaten='".$loadId."' order by nama_kecamatan asc";
  11. }
  12. $res=mysql_query($sql);
  13. $check=mysql_num_rows($res);
  14. if($check > 0){
  15.     $HTML="";
  16.     while($row=mysql_fetch_array($res)){
  17.         $HTML.="<option value='".$row['id']."'>".$row['1']."</option>";
  18.     }
  19.     echo $HTML;
  20. }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement