<?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"];
    $prodtype = $_REQUEST["prodtype"];
    $addflag = $_REQUEST["addflag"];
    $hide_var = "";

    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
//    $mctr++;
    $ctr--;
    echo "<tr>";
    echo "<td><i class='fa fa-close remove' style='display:none;'></i></td>";
    echo "<td>";
    echo "<select class='form-control form finyear select2' name='finyear_$ctr' style='width:100%'>";
    echo "<option value=''></option>";
    $gyear = mysqli_query($conn, "SELECT `finyear`,`yearname` FROM `compyear`") or die(mysqli_error($conn));
    while ($year = mysqli_fetch_array($gyear)) {
        echo "<option value='$year[finyear]'>$year[yearname]</option>";
    }
    echo "</select>";
    echo "</td>";
    echo "<td><input type='text' class='form-control form yearname' name='yearname_$ctr' value='' readonly></td>";
    echo "<td><input type='text' class='form-control form startdate' name='startdate_$ctr' value='' readonly></td>";
    echo "<td><input type='text' class='form-control form lastdate' name='lastdate_$ctr' value='' readonly></td>";
    echo "</tr >";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 