<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');
header('Content-Type: text/html; charset=utf-8');

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

if ($_REQUEST["tableno"]) {

    $tableno = $_REQUEST["tableno"];
    $tablecond = "";

    if (!empty($tableno)) {
        $tablecond = "and `code` != '$tableno'";
    }

    echo "<select class='form-control tablenomul' name='tablenomul[]' multiple>";
    $gettablemul = mysqli_query($conn, "SELECT `code`, `name` FROM `tablemast` WHERE book = '' $tablecond order by `name`") or die(mysqli_error($conn));
    while ($tablemul = mysqli_fetch_array($gettablemul)) {
        echo "<option value='$tablemul[code]'>$tablemul[name]</option>";
    }
    echo "</select>";
} else {
    echo "ERROR";
}
?>