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

		$operation_name		=	trim($_POST['operation_name']); 
		$operation_sign		=	$_POST['operation_sign']; 

		$SLCT_chk = "SELECT * FROM operation_types WHERE operation_name='$operation_name'";
		$QURY_chk = mysqli_query($connect,$SLCT_chk);
		$FTCH_chk = mysqli_num_rows($QURY_chk);
		if($FTCH_chk==0){

		$INSRT = "INSERT INTO operation_types (`operation_name`,`operation_sign`,`statu_s`, `post_dt`) VALUES ('$operation_name','$operation_sign','active','$cur_time')";
		$QURY		= mysqli_query($connect,$INSRT);	
?>
		<script type="text/javascript">
            alert("Data inserted successfully");
            //history.back();
            window.location='../master_operation_types.php';
        </script>
		
		<?php } else { ?>
				<script type="text/javascript">
            alert("Already Exists!!!");
            //history.back();
            window.location='../master_operation_add.php';
        </script>

		
		<?php } ?>
