<?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];
$success = false;

$prodtype = $_REQUEST['prodtype'];

if (isset($_REQUEST["prodtype"])) {

    $query = "SELECT `code`, `name` FROM `item` WHERE code!='' AND `prodtype`='$prodtype' ORDER BY `name`";

    $result = mysqli_query($conn, $query)or die(mysqli_error($conn));
    
    $ctr = 0;
    Echo "<option value=''></option>";
    while ($r = mysqli_fetch_assoc($result)) {
        Echo "<option value='$r[code]'>$r[name]</option>";
    }
}