<?php
include "config.php"; // DB connection

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['id'])) {
        $id = mysqli_real_escape_string($con, $_POST['id']);

        $query = "DELETE FROM policestation WHERE id = '$id'";

        if (mysqli_query($con, $query)) {
            // Redirect or return success
                           echo '<script>window.location.href = "police_station.php";</script>';
        } else {
            echo "Error deleting record: " . mysqli_error($con);
        }
    } else {
        echo "Invalid request: ID missing.";
    }
} else {
    echo "Invalid request method.";
}
?>