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


$Item_id=$_POST['Item_id'];
$Item_name=$_POST['Item_name'];
$Item_check=$_POST['Item_check'];


echo $Item_id.$Item_name;

//exit;


if($Item_id == "" || $Item_name == ""){
    ?>
        <script language="JavaScript" type="text/javascript">
			<!--
			alert("กรุณากรอกข้อมูลให้ครบถ้วน !!! ");
			location.href='../admin/data_item.php';
			//-->
		</script>
    <?php 
}else{
    
    $sql = "INSERT INTO `qc_item` (`Item_id`, `Item_name`,`Item_check`,`Item_status`) VALUES ('$Item_id', '$Item_name',  '$Item_check','A')";
	$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);
}




?>