 <?php
include('../config.php');

// Check if truck_no is set in POST data
if(isset($_POST['truck_no'])) {
    $truck_no = $_POST['truck_no'];
    //echo "SELECT * FROM truck_mst WHERE truck_no LIKE '%" . $truck_no . "%'";
    $query = mysqli_query($conn, "SELECT * FROM truck_mst WHERE truck_no LIKE '%" . $truck_no . "%'");
    $result1 = array();
    if(mysqli_num_rows($query) > 0) {
        $rows = mysqli_fetch_assoc($query);
        $result1['height'] = $rows['height'];
        $result1['lorry_type'] = $rows['lorry_type'];
    }
    echo json_encode($rows);
} else {
    echo json_encode(array('error' => 'Truck number not provided'));
}
?>
