<?php
include "../config.php";
$data = array();
if (!empty($_POST["id"])) {
    $id = $_POST['id'];
    $time = $_POST['timeX'];
	$timeZ = "('".implode("','",$time)."')";
	$columnS=array("Q9g","State","City");
    $mq=query_marge($time,$columnS);
    
    $state_arr = '('.'"' . implode('", "', $id) . '"'.')';
    $query = "SELECT DISTINCT `city` FROM ($mq) AS t WHERE t.`Q9g` IN $timeZ AND `State` IN $state_arr";
    $result = mysqli_query($conn,$query);
    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            array_push($data,$row['city']);
            //echo '<option value="' . $row['zone'] . '">' . $row['zone'] . '</option>';
        }
    }
}

echo json_encode($data);

?>