<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$maindb = 'visaform';

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

$paxno = $_REQUEST["paxno"];
$qry = mysqli_query($conn, "SELECT * FROM `$maindb` where `paxno` ='$paxno' ") or die(mysqli_error($conn));
//$rows = array();
$row = mysqli_fetch_array($qry);
$name = $row['surname'] . $row['midname'] . $row['lastname'];

$rows = array('success' => true,
    'name' => $name,
    'gender' => $row['gender'],
    'relation' => $row['relation'],
    'fullpay' => $row['fullpay']
);
header("Content-type: application/json");
echo json_encode($rows);
?>