<?php
include '../db.php'; // Include database connection
if (isset($_POST['state_id'])) {
    $state_id = mysqli_real_escape_string($con, $_POST['state_id']);
    $sql = "SELECT id, distName FROM dist WHERE stateId = '$state_id' ORDER BY distName ASC";
    $res = mysqli_query($con, $sql);
    while ($row = mysqli_fetch_assoc($res)) {
        echo "<option data-id='{$row['id']}' value='{$row['distName']}'>{$row['distName']}</option>";
    }
}
?>