<?php

include "../../config/db.php";

$block_id = $_GET['block_id'] ?? 0;

$q = mysqli_query($conn,"
SELECT id, village_name
FROM villages
WHERE block_id='$block_id'
ORDER BY village_name
");

echo "<option value=''>Select Village</option>";

while($row = mysqli_fetch_assoc($q))
{
echo "<option value='".$row['id']."'>".$row['village_name']."</option>";
}