<?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"];
    $touramt = $_REQUEST["touramt"];
    $ticktamt = $_REQUEST["ticktamt"];
    $hide_var = "";
    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
    $mctr++;
    ?>
    <tr>
        <td>
            <select name="suffix_<?= $ctr ?>" id="suffix" style="width:100%;" class="form-control suffix form select2 fetchpart_<?= $ctr ?>">
                <option></option>
                <?php
                $getsuff = mysqli_query($conn, "Select * from suffix order by name");
                while ($row = mysqli_fetch_array($getsuff)) {
                    echo "<option value='$row[name]'>$row[name]</option>";
                }
                ?>
            </select>
        </td>
        <td><input type="text" name="paxname_<?= $ctr ?>" class="form-control form paxname"></td>
        <td>
            <select name="paxgend_<?= $ctr ?>" id="paxgend" style="width:100%;" class="form-control paxgend form select2 fetchpart_<?= $ctr ?>">
                <option value='M'>Male</option>
                <option value='F'>Female</option>
            </select>
        </td>
        <td><input type="number" step='any' name="ticktamt_<?= $ctr ?>" class="form-control form text-right ticktamt" value="<?= $ticktamt ?>"></td>
        <td><input type="number" step='any' name="touramt_<?= $ctr ?>" class="form-control form text-right touramt" value="<?= $touramt ?>"></td>
        <td><input type="text" name="paxpass_<?= $ctr ?>" class="form-control form paxpass"></td>
        <td><input type="text" name="manualno_<?= $ctr ?>" class="form-control form manualno"></td>
    </tr>
    <?php
    $ctr++;
} else {
    echo "ERROR";
}
