<?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 ></td>";

    echo "<td><input type='number'   name='paxno_$ctr' maxlength='4' class='focusFld_$ctr paxno form-control form' style='text-align:right;' value='' /></td>";
    echo "<td><input type='text'   name='category_$ctr' class='category form-control form' style='text-align:left;' value=''  /></td>";
//    echo "<td><input type='text'   name='cateng_$ctr' class='cateng  form-control form' style='text-align:left;' value='' /></td>";
    echo "<td><input list='cateng' name='cateng_$ctr' value='' class=' form-control form ' autocomplete='off'>";
                                echo "<datalist id='cateng'>";
                                    echo "<option value=''>";
                                        $gcat = mysqli_query($conn, "SELECT `name` FROM `catgmast` where code!=''") or die(mysqli_error($conn));
                                        while ($fcat = mysqli_fetch_array($gcat)) {
                                            echo "<option value = '$fcat[name]' > ";
                                        }
                                echo "</datalist>";
                                echo "</td>";
    echo "<td><input type='text'   name='nationality_$ctr' class='nationality form-control form' style='text-align:left;' value='' /></td>";
    echo "<td><input type='date'   name='visaiss_$ctr' class='visaiss form-control form' style='text-align:left;' value='' /></td>";
    // echo "<td><input type='number' name='avlbl_$ctr' maxlength='4' class='avlbl form-control form' style='text-align:right;' value='' /></td>";
    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 