<?php
	//Connects to your Database
	include "../db_connection/db_connection.php";
	include "../config/config.php";		
	                    
	
		//cr_name,cr_url,phon_no
		$cat_name		=	trim($_POST['cr_name']); 
		$cost_vl		=	trim($_POST['cr_url']); 
		$ca_date		=	$_POST['phon_no']; 
		$SLCT_chk = "SELECT * FROM mas_cour_det WHERE cour_name='$cat_name'";
		$QURY_chk = mysqli_query($connect,$SLCT_chk);
		$FTCH_chk = mysqli_num_rows($QURY_chk);
		if($FTCH_chk==0){

		$INSRT		= "INSERT INTO mas_cour_det(`cour_name`, `cour_url`, `phone_no`, `post_dt`) VALUES ('$cat_name','$cost_vl','$ca_date','$cur_time')";
		//echo $INSRT;
		$QURY		= mysqli_query($connect,$INSRT);	
		
?>
		<script type="text/javascript">
            //alert("Data inserted successfully");
            //history.back();
            window.location='../master_cour_list.php';
        </script>
		<?php } else { ?>
			<script type="text/javascript">
            alert("Already Exists!!!");
            //history.back();
            window.location='../master_cour_add.php';
        </script>
		<?php } ?>
		
	
