<?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><i class='fa fa-close remove' $hide_var ></i></td>";
Echo "<td><input type='text' class='form-control form text-right srno2' name='srno2_$ctr' value='$mctr'></td>";
    Echo "<td>";
Echo "<input type='text' class='form-control form barcode' name='barcode_$ctr' value=''>";
Echo "</td>";
Echo "<td>";
Echo "<select class='form-control form item2 fetchpart_$ctr' name='item2_$ctr' style='width:100%'>";
Echo "<option value=''></option>";
$gitem2 = mysqli_query($conn, 'SELECT `code`,`name` FROM `item`  order by name')or die(mysqli_error($conn));
while ($item2 = mysqli_fetch_array($gitem2)) {
    Echo "<option value='$item2[code]'>$item2[name]</option>";
}
Echo "</select>";
Echo "</td>";
Echo "<td>";
Echo "<select class='form-control form color2 select2 fetchpart_$ctr' name='color2_$ctr' style='width:100%'>";
Echo "<option value=''></option>";
$gcolor2 = mysqli_query($conn, 'SELECT `code`,`name` FROM `color` order by name')or die(mysqli_error($conn));
while ($color2 = mysqli_fetch_array($gcolor2)) {
    Echo "<option value='$color2[code]'>$color2[name]</option>";
}
Echo "</select>";
echo "</td>";
Echo "<td><input type='text' class='form-control form text-right qty2'      name='qty2_$ctr'      value='0'></td>";
Echo "<td><input type='text' class='form-control form text-right rate2'  id='rate2_$ctr'   name='rate2_$ctr'     value='0'></td>";
Echo "<td><img id='preview' src='' alt='your image' style='height:100px;width:100%'/></td>";
Echo "</tr >";
$ctr++;
//} else {
//    echo "ERROR";
//}
?>
 