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

		$membership_name = trim($_POST['membership_name']); 
		$membership_days =	$_POST['membership_days']; 
		$SLCT_chk = "SELECT * FROM member_types WHERE member_type='$membership_name'";
		$QURY_chk = mysqli_query($connect,$SLCT_chk);
		$FTCH_chk = mysqli_num_rows($QURY_chk);
		if($FTCH_chk==0){

		$INSRT = "INSERT INTO member_types (`member_type`,`member_days`,`statu_s`, `post_dt`) VALUES ('$membership_name','$membership_days','active','$cur_time')";
		$QURY = mysqli_query($connect,$INSRT);	
?>
		<script type="text/javascript">
            alert("Data inserted successfully");
            //history.back();
            window.location='../master_member_list.php';
        </script>
<?php } else { ?>
				<script type="text/javascript">
            alert("Already Exists!!!");
            //history.back();
            window.location='../master_member_add.php';
        </script>

		
		<?php } ?>
