<?php
	//Connects to your Database
	include "../db_connection/db_connection.php";
	include "../config/config.php";

		$cat_name		=	trim($_POST['cat_name']); 
		$cost_vl		=	$_POST['cat_cst']; 
		$ca_date		=	$_POST['ca_date']; 
		$ca_pnts		=	$_POST['ca_pnts']; 
		$SLCT_chk = "SELECT * FROM master_cad_cat WHERE cad_cat_name='$cat_name'";
		$QURY_chk = mysqli_query($connect,$SLCT_chk);
		$FTCH_chk = mysqli_num_rows($QURY_chk);
		if($FTCH_chk==0){

		$INSRT		= "INSERT INTO master_cad_cat(`cad_cat_name`,`cat_hrs`,`cat_date`, `post_dt`) VALUES ('$cat_name','$cost_vl','$ca_date','$cur_time')";
		//echo $INSRT;
		$QURY		= mysqli_query($connect,$INSRT);
		//exit;
?>
		<script type="text/javascript">
            //alert("Data inserted successfully");
            //history.back();
            window.location='../master_cad_cat_list.php';
        </script>
		<?php } else { ?>
			<script type="text/javascript">
            alert("Already Exists!!!");
            //history.back();
            window.location='../master_cad_cat_add.php';
        </script>
		<?php } ?>