<?php 
include("h3.php");
$NewsTitle = $_POST['NewsTitle'];
$Detail = $_POST['Detail'];
$PostAuther = $_POST['PostAuther'];
$sub_work_ID = $_POST['sub_work_ID'];

//echo "$Group_ID--$QuizTitle--$Level_ID--$QuizYear--$TestType_ID";
?>
<center>
<br>
<?php
if($emp_name<>""&&$error<>1){
?>

<?php
    date_default_timezone_set('Asia/Bangkok');
$dateDB = date("Y-m-d H:i:s");
$com_comand_date=$dateDB;
$DD = explode("/", $com_comand_date);
$A=$DD[0];
$B=$DD[1];
$C=$DD[2]+543;
$NewsTitle = $_POST['NewsTitle'];
$Detail = $_POST['Detail'];
$PostAuther = $_POST['PostAuther'];
$sub_work_ID = $_POST['sub_work_ID'];
if($NewsTitle<>""&&$Detail<>""&&$PostAuther<>"")
	{

//	$date2 = date("d/m/Y");
	// เพิ่มไฟล์เข้าไปในตาราง news_Master
		$sql="INSERT INTO news_master  (title,Detail,auther,views_count,like_count,news_post_date,active_status,sub_work_id)  VALUES ('$NewsTitle','$Detail','$PostAuther',0,0,'$dateDB',1,'$sub_work_ID')";
		$dbquery = mysqli_query($con, $sql);

	echo "<font size=\"4\" color=\"#33ff00\"><strong>Success POST News</strong></font><BR>";
	echo "<a href=\"frm_post_news.php\">Back to Post</a><br>";
	echo "<a href=\"list_post_news.php\">Show News All Post</a>";
	}
	else
	{
	echo "<font size=\"4\" color=\"#ff0000\"><strong>Error (No data to post)</strong></font><BR>";
	echo "<a href=\"frm_post_news.php\">Back to Post</a><br>";

	}
?>
<BR>
<?php
}
else{
      echo  "<CENTER>คุณไม่ผ่านการ Login /คุณคือไม่ได้รับสิทธิ์ในการใช้งาน?...</CENTER>";
      echo  "<CENTER><a href=\"index.php\">กลับสู่หน้า Login  อีกครั้ง</a></CENTER>";
}
?>

</center>
<?php 
include("button.php");
?>
