<?php
include "db_connection.php";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $bonus_id = $_POST['bonus_id'];

    // Delete the bonus entry
    $query = "DELETE FROM bonuses WHERE id='$bonus_id'";

    if (mysqli_query($conn, $query)) {
        echo "<script>alert('Bonus removed successfully!'); window.location.href='remove_bonus.php';</script>";
    } else {
        echo "<script>alert('Error: " . mysqli_error($conn) . "'); window.history.back();</script>";
    }

    mysqli_close($conn);
}
?>
