<?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><i class='fa fa-close remove'></i></td>";
    echo "<td><input type='text' class='form-control form text-right srno'    name='srno_$ctr'     value='$mctr'></td>";
    echo "<td><input type='text' class='form-control form paxno'        name='paxno_$ctr' value=''></td>";
    echo "<td><input type='text' class='form-control form paxname'        name='paxname_$ctr' value=''></td>";
    echo "<td>";
    echo "<select class='form-control form tgender select2 fetchpart_' name='tgender_$ctr' style='width:100%'  required>";
    echo "<option value=''></option>";
    echo "<option value='M'>Male</option>";
    echo "<option value='F'>Female</option>";
    echo "</select>";
    echo "</td>";
    echo "<td>";
    echo "<select class='form-control form trelate select2 trelate_' name='roomtype_$ctr' style='width:100%'  required>";
    echo "<option value=''></option>";
    $getrelate = mysqli_query($conn,"SELECT * from relation where `code`!='' ") or die(mysqli_error($conn));
    while ($fetrelate = mysqli_fetch_array($getrelate)){
    echo "<option value='$fetrelate[code]'>$fetrelate[name]</option>";
    }
    echo "</td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
