<?php
include_once './dbconn.php';

if(isset($_GET['id'])) {
    $id = $_GET['id'];

    $sql = "SELECT * FROM  web_app_enrollee_data WHERE id = '$id'";
    $result = mysqli_query($conn, $sql);
    $result_checker = mysqli_num_rows($result);
    if ($result_checker > 0) {
        while ($data = mysqli_fetch_assoc($result)) {
            $status = $data["status"];
            
        }
    }
    
    // SQL query to update data in the database
    $sql = "UPDATE web_app_enrollee_data 
            SET status = 'Denied'
            WHERE id = '$id'";

    // Execute the query
    if ($conn->query($sql) === TRUE) {
    header("Location: ./index.php?denied");
        exit();
    } else {
        echo "Error Dening record: " . $conn->error;
    }

    // Close connection
    $conn->close();


    
} else {
    // header("Location: ./index.php");
    die();
}

?>