<?php

require_once './connection.php';

if (!isset($_POST['taluka_id']) == "") {
    $taluka_id = $_POST['taluka_id'];
//    echo '$district_id '.$district_id;
    $result = array();

    $sql = 'select * from tbl_village where taluka_id="'.$taluka_id.'" and flag="1" ORDER by id ASC';
//echo 'query ' . $sql;
    try {
        if ($con) {
            mysqli_set_charset($con, 'utf8');
            $response = mysqli_query($con, $sql);
//        print_r($response);
            if (mysqli_num_rows($response) > 0) {

                while ($row = mysqli_fetch_assoc($response)) {
                    $index["id"] = $row["id"];
                    $index["village"] = $row["village"];
                    $index["village_hindi"] = $row["village_hindi"];
                    $index["village_guj"] = $row["village_guj"];

                    array_push($result, $index);
                }
//            $result["success"] = "1";
                echo json_encode($result);
            } else {
                echo 'NO_Record_Found';
            }
        } else {
            echo 'Connection Problem';
        }
    } catch (Exception $ex) {
        echo $e->getMessage();
    }
} else {
    echo 'Taluka ID Not Set';
}
?>
