
<?php
include_once('shikanisha.kts.php');

if(isset($_POST['order_id'])) {

// Get the receipt ID from the Ajax request
$receipt_id = $_POST['order_id'];

// Fetch order details from the database
$sql = "SELECT * FROM sales_order WHERE order_id = $receipt_id";
$result = mysqli_query($conn, $sql);

// Check if there are any results
if (mysqli_num_rows($result) > 0) {
    // Loop through the results and store them in an array
    while ($row = mysqli_fetch_assoc($result)) {
        $order_details[] = $row;
    }

    // Return the order details as JSON
    echo json_encode($order_details);
} else {
    // If there are no results, return an error message
    echo json_encode(['error' => 'No order details found']);
}}
?>
