<?php
include 'db.php';

if (isset($_GET['visa_type_id'])) {
    $visa_type_id = (int)$_GET['visa_type_id'];
    $query = mysqli_query($conn, "SELECT id, sub_visa_type FROM sub_visa_types WHERE visa_type_id = $visa_type_id");

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

    header('Content-Type: application/json');
    echo json_encode($result);
}
?>
