<?php
include "config.php";

if (isset($_POST['id']) && isset($_POST['status'])) {
    $id = intval($_POST['id']);  // sanitize ID
    $status = mysqli_real_escape_string($con, $_POST['status']); // sanitize status

    $query = "UPDATE ipdr SET status='$status' WHERE id=$id";

    if (mysqli_query($con, $query)) {
        // Redirect back to the IPDR page with a message
        header("Location: ipdr.php?msg=Status+Updated");
        exit();
    } else {
        echo "Error updating status: " . mysqli_error($con);
    }
}
?>