<?php 
if(!isset($_SESSION)) { 
  session_start(); 
  include('../includes/dbcon.php');
}
if(empty($_SESSION['rm_id'])):
header('Location:../index.php');
endif;



if (isset($_POST['cus_id'])) {
    $cus_id = intval($_POST['cus_id']);

    // Query to fetch vat_required
    $query = mysqli_query($con, "SELECT delivery_id,delivery_name	 FROM customer_master_delivery WHERE cus_id = $cus_id") or die(mysqli_error($con));

    $delivery_data = [];
    while ($row = mysqli_fetch_assoc($query)) {
        $delivery_data[] = $row;
    }

    // Return as JSON
    echo json_encode($delivery_data);
    exit();

 
    
} 
?>