<?php
include "../db.php";

if (isset($_POST['product_id']) && isset($_POST['status'])) {
    $product_id = mysqli_real_escape_string($con, $_POST['product_id']);
    $status = mysqli_real_escape_string($con, $_POST['status']);

    $sql = "UPDATE product SET pStatus = '$status' WHERE pid = '$product_id'";
    if (mysqli_query($con, $sql)) {
        echo "Status updated successfully!";
    } else {
        echo "Error updating status: " . mysqli_error($con);
    }
}
?>