<?php

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

$village_id = isset($_GET['village_id']) ? intval($_GET['village_id']) : 0;

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

$query = mysqli_query($conn,"
SELECT id, work_name
FROM donation_categories
WHERE village_id='$village_id'
ORDER BY work_name
");

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

?>