<?php
require_once '../app/db.php';

$id = $_POST['id'];
$reference = $_POST['reference'];

$pdo->prepare("
UPDATE bookings 
SET payment_status='pending', payment_method='paynow'
WHERE id=?
")->execute([$id]);

$pdo->prepare("
INSERT INTO payments (booking_id, method, amount, reference)
SELECT id,'paynow',estimated_price,?
FROM bookings WHERE id=?
")->execute([$reference, $id]);

echo "Payment submitted. Awaiting admin confirmation.";
