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


$mac_id=$_POST['mac_id'];
$mac_name=$_POST['mac_name'];
$id_dep=$_POST['id_dep'];




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

        }
        mysqli_close($con);
}




?>