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

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

if ($_REQUEST["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $hide = $_REQUEST["hide"];
    $hide_var = "";
    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
    $mctr++;

    echo "<tr>";
    echo "<td align='center' valign='top'><span class='remove fa fa-times' name='remove' value='remove' $hide_var></span></td>";
    echo "<td><input type='text' style='text-align:center;' value='$mctr'  name='srno_$ctr'  class='srno form-control form' readonly >
    <input type='hidden' class='dpflg form-control form text-center' value='$mctr'></td>";
    echo "<td><input type='text' name='paxname_$ctr' class='focusFld_$ctr paxname form-control form' style='text-align:left;' value=''/></td>";
    echo "<td><input type='text' name='passport_$ctr' class='passport form-control form' style='text-align:left;' value='' /></td>";
    echo "<td>";
    echo "<input list='ref' name='ref_$ctr' class='ref form-control form ' autocomplete='off' value=''> ";
    echo "<datalist id='ref' char='#'>";
    echo "<option>";
    $msi = mysqli_query($conn, "SELECT `name` FROM `accmast` WHERE `grpcode`='040' group by `name`") or die(mysqli_error($conn));
    while ($tsi = mysqli_fetch_array($msi)) {
        $szname = $tsi['name'];
        echo "<option value='$szname'>";
    }
    echo "</datalist>";
    echo "</td>";
    // echo "<td><input type='text' name='ref_$ctr' class='ref  form-control form' style='text-align:left;' value='' /></td>";
    // echo "<td><input type='date' name='courdt_$ctr' class='courdt form-control form' value='' /></td>";
    echo "<td><input type='text' name='courfrm_$ctr' class='courfrm form-control form' style='text-align:left;' value='' /></td>";
    echo "<td><input type='text' name='status_$ctr' class='status form-control form' value='' /></td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
