<?php
// Include your database connection or any necessary files
include_once 'shikanisha.kts.php';

// Retrieve form data
$bookingId = $_POST['bookid'];
$paidAmount = $_POST['payamount'];
$payMethod = $_POST['paymethod'];

// Your SQL query for inserting data into the room_payments table
$sql = "INSERT INTO `room_payments`(`paid_amount`, `booking_id`, `pay_method`) 
        VALUES ('$paidAmount', '$bookingId', '$payMethod')";

if ($conn->query($sql) === TRUE) {
    $response['status'] = 'success';
    $response['message'] = 'Payment successfully processed.';
} else {
    $response['status'] = 'error';
    $response['message'] = 'Error processing payment: ' . $conn->error;
}

// Output the JSON response
echo json_encode($response);
?>