<?php
require_once __DIR__ . '/../../connect.php';

$passengerId = filterRequest("passengerId");
$feedBack = filterRequest("feedBack");

$feedBack = $encryptionHelper->encryptData($feedBack);

$sql = "INSERT INTO `feedBack`( `passengerId`, `feedBack`, `datecreated`) VALUES (
  
  :passengerId,
  :feedBack,
  NOW()
)";

$stmt = $con->prepare($sql);
$stmt->bindParam(':passengerId', $passengerId);
$stmt->bindParam(':feedBack', $feedBack);
$stmt->execute();


if ($stmt->rowCount() > 0) {
    // Success response
    echo json_encode([
        "status" => "success",
        "message" => "Feedback data saved successfully"
    ]);
} else {
    // Failure response
    echo json_encode([
        "status" => "failure",
        "message" => "Failed to save feedback data"
    ]);
}
?>
