<?php

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


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

if (isset($_REQUEST['gsttype'])) {
    $code = mysqli_real_escape_string($conn, $_REQUEST["gsttype"]);
    $result = mysqli_query($conn, "SELECT `code`, `name` , `per` FROM `gsttype` WHERE `code`='$code'") or die(mysqli_error($conn));
    $array = mysqli_fetch_object($result);

    $fetch = array(
        'per' => $array->per
    );
    header("Content-type: application/json");
    echo json_encode($fetch);
}
?>
