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

$maindb = 'accmast';

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

if ($type == "B") {
    $getopt = mysqli_query($conn, "SELECT * FROM $maindb where grpcode='001' order by `name` ") or die(mysqli_error($conn));
    echo "<option value=''></option>";
    
    while ($fetopt = mysqli_fetch_array($getopt)) {
        echo "<option value='$fetopt[accode]'>$fetopt[name]</option>";
    }

} else {
    $getopt = mysqli_query($conn, "SELECT * FROM $maindb where grpcode='002' order by `name` ") or die(mysqli_error($conn));
    echo "<option value=''></option>";
    
    while ($fetopt = mysqli_fetch_array($getopt)) {
        echo "<option value='$fetopt[accode]'>$fetopt[name]</option>";
    }
}
?>