<?php
include 'connect.php';

$customer = $_GET['customer'];

$get = mysqli_query($conn, "SELECT * FROM customer WHERE ID='$customer'");
$get1 = mysqli_fetch_assoc($get);

$vil = mysqli_query($conn, "SELECT * FROM villages WHERE ID='$get1[village]'");
$vil1 = mysqli_fetch_assoc($vil);

echo '<div>
        <div id="district">
          <option value="" selected="selected">-- Select --</option>';

$sql = mysqli_query($conn, "SELECT * FROM districts WHERE state='32'") or die(mysqli_error($conn));
while ($result = mysqli_fetch_assoc($sql)) {
  echo '<option value="' . $result['ID'] . '">' . $result['district'] . '</option>';
}

echo '</div>
        <div id="taluk">
          <option value="" selected="selected">-- Select --</option>';

$tlk = mysqli_query($conn, "SELECT * FROM taluk WHERE district='$get1[district]'") or die(mysqli_error($conn));
while ($tlk1 = mysqli_fetch_assoc($tlk)) {
  echo '<option value="' . $tlk1['ID'] . '">' . $tlk1['taluk'] . '</option>';
}

echo '</div>
        <div id="village">
          <option value="" selected="selected">-- Select --</option>';

$vil = mysqli_query($conn, "SELECT * FROM villages WHERE taluk='$get1[taluk]'") or die(mysqli_error($conn));
while ($vil1 = mysqli_fetch_assoc($vil)) {
  echo '<option value="' . $vil1['ID'] . '">' . $vil1['village'] . '</option>';
}

echo '</div>
      </div>';

echo "<div id='doorno'>" . $get1['doorno'] . "</div>
      <div id='street'>" . $get1['street'] . "</div>
      <div id='dist'>" . $get1['district'] . "</div>
      <div id='talk'>" . $get1['taluk'] . "</div>
      <div id='vill'>" . $get1['village'] . "</div>
      <div id='mobile1'>" . $get1['mobile1'] . "</div>
      <div id='mobile2'>" . $get1['mobile2'] . "</div>";
?>
