<?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 srno' name='srno_$ctr' value='$mctr'></td>";
    Echo "<td>";
    Echo "<select class='form-control form select2 fetchpart_$ctr' name='delvcomp_$ctr' style='width:100%'>";
    Echo "<option value=''></option>";
    $tunit = mysqli_query($conn, "SELECT `code`,`name` FROM `delvcomp` order by name")or die(mysqli_error($conn));
    while ($trunit = mysqli_fetch_object($tunit)) {
        Echo "<option value='$trunit->code'>$trunit->name</option>";
    }

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