<?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 style='text-align:center'><i class='fa fa-close remove' ></i></td>";
    echo "<td><input type='text' class='form-control form text-center srno'    name='srno_0'     value='$mctr'></td>";
    echo "<td><input type='text' class='form-control form paxname' maxlength='40'  name='paxname_$ctr' value=''></td>";
    echo "<td>";
    echo "<select class='form-control form lcheckin select2 fetchpart_$ctr' name='from_$ctr' style='width:100%'>";
    echo "<option value=''></option>";
    $gfrm = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
    while ($ifrm = mysqli_fetch_array($gfrm)) {
        echo "<option value='$ifrm[name]'>$ifrm[name]</option>";
    }
    echo "</select>";
    echo "</td>";

    echo "<td>";
    echo "<select class='form-control form lcheckout select2 fetchpart_$ctr' name='to_$ctr' style='width:100%'>";
    echo "<option value=''></option>";
    $gto = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
    while ($ito = mysqli_fetch_array($gto)) {
        echo "<option value='$ito[name]'>$ito[name]</option>";
    }
    echo "</select>";
    echo "</td>";

    echo "<td><input type='date' name='travdate_$ctr' value='' class='form-control form travdate'></td>";

    Echo "<td>";
    Echo "<select class='form-control form airline select2 fetchpart_$ctr' name='airline_$ctr' style='width:100%'  required>";
    Echo "<option value=''></option>";
    $git = mysqli_query($conn, "SELECT `code`,`name` FROM `airline` ORDER BY `name`")or die(mysqli_error($conn));
    while ($itm = mysqli_fetch_array($git)) {
        Echo "<option value='$itm[code]'>$itm[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";
    
    echo "<td><input type='text' class='form-control form ppno' maxlength='15'  name='ppno_$ctr' value=''></td>";
    echo "<td><input type='text' name='ticketno_$ctr' value='' class='form-control form ticketno '></td>";
    echo "<td><input type='text' name='flightno_$ctr' value='' class='form-control form flightno'></td>";
    echo "<td><input type='text' name='pnr_$ctr' value='' class='form-control form pnr'></td>";
    echo "<td><input type='text' class='form-control text-right form amount' name='amount_$ctr' value='0'></td>";

    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 