<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$admin = $_SESSION["admin_" . $dbname];
$success = false;

if (isset($_REQUEST["area"])) {
    $state = $_REQUEST['area'];

    $getdistrict = mysqli_query($conn, "SELECT district FROM disttaluka WHERE state ='$state' group by district order by district") or die(mysqli_error($conn));
    while ($dtrow1 = mysqli_fetch_array($getdistrict)) {
        echo "<option value='$dtrow1[district]'>$dtrow1[district]</option>";
    }
}

if (isset($_REQUEST["district"])) {
    $district = $_REQUEST['district'];

    $gettaluka = mysqli_query($conn, "SELECT taluka FROM disttaluka WHERE district ='$district' group by taluka order by taluka") or die(mysqli_error($conn));
    while ($row1 = mysqli_fetch_array($gettaluka)) {
        echo "<option value='$row1[taluka]'>$row1[taluka]</option>";
    }
}
if (isset($_REQUEST["bsarea"])) {
    $state = $_REQUEST['bsarea'];

    $getdistrict = mysqli_query($conn, "SELECT district FROM disttaluka WHERE state ='$state' group by district order by district") or die(mysqli_error($conn));
    while ($dtrow1 = mysqli_fetch_array($getdistrict)) {
        echo "<option value='$dtrow1[district]'>$dtrow1[district]</option>";
    }
}

if (isset($_REQUEST["bsdistrict"])) {
    $district = $_REQUEST['bsdistrict'];

    $gettaluka = mysqli_query($conn, "SELECT taluka FROM disttaluka WHERE district ='$district' group by taluka order by taluka") or die(mysqli_error($conn));
    while ($row1 = mysqli_fetch_array($gettaluka)) {
        echo "<option value='$row1[taluka]'>$row1[taluka]</option>";
    }
}
