<?php
include '_db.php';

session_start();

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    
    // Use prepared statement to delete record
    $delete_query = $conn->prepare("DELETE FROM withdrawals WHERE id = ?");
    $delete_query->execute([$delete_id]);

    if ($delete_query) {
        header('location: confirmed_withdrawal.php');
        $_SESSION['message'] = 'Withdrawal has been deleted';
    } else {
        header('location: confirmed_withdrawal.php');
        $_SESSION['message'] = 'Withdrawal could not be deleted';
    }
}
?>
