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

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

if (isset($_REQUEST['itemcode'])){
    $itemcode = $_REQUEST['itemcode'];
    
//    $series = $_REQUEST['series'];
    
        $getitm  = mysqli_query($conn, "SELECT `code`, `name` FROM `rawmat` WHERE `code`='$itemcode' ")or die(mysqli_error($conn));
        $itm     = mysqli_fetch_array($getitm);

        Echo "<option value='$itm[code]'>$itm[name]</option>";
        $getitm2 = mysqli_query($conn, "SELECT code, name FROM `rawmat` where code != ''  ORDER BY `name`")or die(mysqli_error($conn));
        while ($itm2 = mysqli_fetch_array($getitm2)) {
              Echo "<option value='$itm2[code]'>$itm2[name]</option>";
        }
}
?>