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


$dep_id=$_POST['dep_id'];
$dep_name=$_POST['dep_name'];



//exit;


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

        }
        mysqli_close($con);
}




?>