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


$Topic_id=$_POST['Topic_id'];
$Topic_name=$_POST['Topic_name'];
$Topic_type=$_POST['Topic_type'];


echo $Topic_id.$Topic_name.$Topic_type;

//exit;


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

        }
        mysqli_close($con);
}




?>