<?php

session_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 align='left' valign='top'><input type='text' size='6' maxlength='6' name='srno_$ctr' class='sno form-control' style='height:33px;' value='$mctr'/></td>";

    echo "<td align='left'>";
    echo "<select name='location_$ctr' style='height:34px;' class='form-control form'>";
    echo "<option value='$loc->code'>$loc->name</option>";
    $getlocation = mysqli_query($conn, "SELECT `code`, `name` FROM `location` ORDER BY `name`") or die(mysqli_error($conn));
    while ($wloc = mysqli_fetch_array($getlocation)) {
        echo "<option value='$wloc[code]' >$wloc[name]</option>";
    }
    echo "</select>";
    echo "</td>";
    echo "<td align='center' valign='top'><input type='text' size='4'  name='qty_$ctr' class='qty form-control'  style='text-align:right;height:33px;' value='0'></td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 