Php Nöbetci Eczaneler Botu Mobil Uyumlu

Php Nöbetci Eczaneler Botu Mobil Uyumlu
<html>
<head>
    <title>İl ilçe</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
</head>

<body>
<form action="" method="post">
<div class="container">
    <div class="row">
        <div class="col-md-12"><h1>Nöbetçi Eczaneler</h1></div>
        <div class="col-md-3">
            <select name="il" id="il" class="form-control">
                <option value="">Seçin...</option>
            </select>
        </div>

        <div class="col-md-3">
            <select name="ilce" id="ilce" class="form-control" disabled="disabled">
                <option value="">Seçin...</option>
            </select>
        </div>
        <div>  
                <button type="submit" class="btn btn-succes">Gönder</button>
        </div>  
         <?php

                function harfDegistir($Deger){
                $bul = @$_POST[$Deger];
                $bulunacak = array('A','B','C','Ç','D','E','F','G','Ğ','H','I','İ','J','K','L','M','N','O','Ö','P','R','S','Ş','T','U','Ü','V','Y','Z');
                $degistir  = array('a','b','c','c','d','e','f','g','g','h','i','i','j','k','l','m','n','o','o','p','r','s','s','t','u','u','v','y','z');
                $sonuc=str_replace($bulunacak, $degistir, $bul);
                return $sonuc;
                }
                
                $bulil='il';
                

                $bulilce='ilce';
              


            if(@$_POST["ilce"]==""){ }
                else{
                    $site = "https://www.mynet.com/".harfDegistir($bulil)."/".harfDegistir($bulilce)."-nobetci-eczaneler";
                    $bolme = ('@<div class="col-7">.*?</div>@si');
                    $bolme2 = ('@<p><strong>Adres:</strong>.*?</p>@si');
                    $bolme3 = ('@<p><strong>Telefon:</strong>.*?</p>@si');
                    $arama = file_get_contents($site);
                    preg_match_all($bolme,$arama,$ezcaneadi);
                    preg_match_all($bolme2,$arama,$eczaneadres);
                    preg_match_all($bolme3,$arama,$eczanetel);

                    if(@$ezcaneadi[0][0]!="") {
                        $salaksacma = array($ezcaneadi);
                    $eczaneSayisiSay = (count($salaksacma[0],1)-1);
                      
 
                    
                



                       ?>

                        <table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">Eczane Adı</th>
      <th scope="col">Adres</th>
      <th scope="col">Telefon</th>
      </tr>
    </thead>
  <tbody>
  
    <?php
  


 for ($i=0; $i < $eczaneSayisiSay; $i++) {

?>
  
    <tr>
      <th scope="row"><?php echo $i+1; ?></th>
      <td> <?php   echo $ezcaneadi[0][$i]; ?></td>
      <td><?php   echo $eczaneadres[0][$i]; ?></td>
      <td><?php   echo $eczanetel[0][$i]; ?> </td>
    </tr>
    <?php
 }
?>    
  </tbody>
</table>
        <?php
          


            }else{
            ?>
              <table class="table">
                <thead>
                    <tr>
                        <th><center>Kayıt Bulunamadı</center></th>
                    </tr></thead></table>

            <?php
        }
                }
             ?>
    </div>
</div>
</form>

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script>
    $.getJSON("il-bolge.json", function(sonuc){
        $.each(sonuc, function(index, value){
            var row="";
            row +='<option value="'+value.il+'">'+value.il+'</option>';
            $("#il").append(row);
        })
    });


    $("#il").on("change", function(){
        var il=$(this).val();

        $("#ilce").attr("disabled", false).html("<option value=''>Seçin..</option>");
        $.getJSON("il-ilce.json", function(sonuc){
            $.each(sonuc, function(index, value){
                var row="";
                if(value.il==il)
                {
                    row +='<option value="'+value.ilce+'">'+value.ilce+'</option>';
                    $("#ilce").append(row);
                }
            });
        });
    });

</script>
</body>
</html>

Dosyalar