<?php 


session_start(); 
    $u_uname = '';
    if (isset($_COOKIE['auth_token']))
    {
        $u_uname = $_COOKIE['auth_token'];
    }else{
        header("location:../login.php");
    }
    include('../include/connection.php');
?>
<?php
// Check if the request method is POST
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Check if row_id parameter is set
    if (isset($_POST['row_id'])) {
        // Get row_id value from the POST parameters
        $rowId = $_POST['row_id'];

        // Perform database update based on the row_id value
        // Assuming $link is your database connection object

        // Escape input to prevent SQL injection
        $rowId = mysqli_real_escape_string($link, $rowId);

        // Update the status in the database
        $sql = "UPDATE `RequestCallCustomer` SET `status` = 'pending' WHERE `id` = '$rowId'";
        if ($link->query($sql) === TRUE) {
            // Status updated successfully
            echo "Status updated successfully";
        } else {
            // Error updating status
            echo "Error updating status: " . $link->error;
        }

        // Close the database connection
        mysqli_close($link);
    } else {
        // Required parameter is missing
        echo "Missing parameter";
    }
} else {
    // Invalid request method
    echo "Invalid request method";
}
?>
