<?php
/*
 * @ PHP 7.2
 * @ Decoder version : 1.0.0.2
 * @ Release on : 27/01/2021
 * @ Website    : http://EasyToYou.eu
 */

require_once "../../_class/baglan.php";
require_once "../../_class/fonksiyon.php";
$id = $_POST["id"];
$ilceid = $_POST["ilceid"];
$dizi = [];
$geridon = "<option value=''>-Seçiniz-</option>";
$geridonb = "<option value=''>-Seçiniz-</option>";
$query = $db->prepare("SELECT * FROM ilce WHERE IL_ID = ? ORDER BY ADI ASC");
$query->execute([$id]);
$islem = $query->fetchALL(PDO::FETCH_ASSOC);
foreach ($islem as $ILCESonuc) {
    $geridon .= "<option value=\"" . $ILCESonuc["ID"] . "\" " . ($ILCESonuc["ID"] == $ilceid ? "selected" : "") . ">" . $ILCESonuc["ADI"] . "</option>";
}
if ($geridon != "") {
    $dizi["basari"] = $geridon;
} else {
    $dizi["basari"] = $geridonb;
}
echo json_encode($dizi);

?>