<?php

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

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

if ($_REQUEST["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $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>";
    Echo "<select class='form-control form select2' name='unittran_$ctr' style='width:100%'>";
    Echo "<option value=''></option>";
    $tunit = mysqli_query($conn, "SELECT `code`,`name` FROM `unit`")or die(mysqli_error($conn));
    while ($trunit = mysqli_fetch_object($tunit)) {
        Echo "<option value='$trunit->name'>$trunit->name</option>";
    }

    Echo "</select>";
    Echo "</td>";
//    Echo "<td><input type='text' class='form-control form ' name='convfact_$ctr' value=''></td>";
    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
