<?php
ob_start();
session_start();
require_once("../conn/conn.php");
//include('../utility/chksession.php');
date_default_timezone_set("Asia/Bangkok");


$id_item=$_POST['id_item'];
$name_item=$_POST['name_item'];
$item_wh=$_POST['item_wh'];

echo $id_item.$name_item.$item_wh;

//exit;


if($id_item == "" || $name_item == ""){
    ?>
        <script language="JavaScript" type="text/javascript">
			<!--
			alert("กรุณากรอกข้อมูลให้ครบถ้วน !!! ");
			location.href='../admin/data_item.php';
			//-->
		</script>
    <?php 
}else{
    
    $sql = "INSERT INTO `pd_item` (`id_item`, `name_item`,`item_wh`) VALUES ('$id_item', '$name_item', '$item_wh')";
	$query = mysqli_query($con,$sql);
        if($query){
            ?>
                <script language="JavaScript" type="text/javascript">
                    <!--
                    alert("บันทึกข้อมูลเรียบร้อย");
                    location.href='../admin/data_item.php';
                    //-->
                </script>
            <?php
        }else{
            
            echo "Error: " . $sql . "<br>" . mysqli_error($con);

        }
        mysqli_close($con);
}




?>