<?php

$servername = 'localhost';
$username   = 'mary4tec_adham';
$password   = 'Adham123Adham123';
$dbName     = 'mary4tec_sb123vm';

try {

    $db = new PDO(
        "mysql:host=$servername;dbname=$dbName;charset=utf8mb4",
        $username,
        $password
    );

    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch(PDOException $e){

    die("DB ERROR");

}

$id     = $_POST['id'] ?? 0;
$status = $_POST['status'] ?? '';

$allowed = ['pending', 'approved', 'rejected'];

if(!in_array($status, $allowed)){

    die("INVALID STATUS");

}

$sql = "UPDATE info SET status = :status WHERE id = :id";

$stmt = $db->prepare($sql);

$stmt->execute([

    ':status' => $status,
    ':id'     => $id

]);

echo "success";