<?php

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

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);
$maindb = 'product';
$zroot = $_SESSION["zdbroot"];
$file = 'getitem.php';

if (isset($_REQUEST["prodcode"])) {
    $prodcode = $_REQUEST["prodcode"];

    $getitem = mysqli_query($conn, "SELECT name FROM $maindb where prodcode = '$prodcode'") or die(mysqli_error($conn));
    $item = mysqli_fetch_array($getitem);
//    if ($item['name'] != '') {
    echo "<option value='$prodcode'>$item[name]</option>";
//    }
    $getp = mysqli_query($conn, "SELECT `prodcode`,`name` FROM `product` order by name") or die(mysqli_error($conn));
    while ($trow = mysqli_fetch_array($getp)) {
        echo "<option value='$trow[prodcode]'>$trow[name]</option>";
    }
}
?>