<?php
 	session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}


date_default_timezone_set("Asia/Kolkata");
$mdate1= date('Y-m-d H:i:s');
$mdate= date('d-m-Y');
$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	$umid = $_SESSION['umid'];
	include("connect.php");

	
	//$cmname=$_POST['cmname'];
	
	
	$rpremark=str_replace ("'","\'",$_POST['rpremark']);
	$rpremark=str_replace ('"','\"',$rpremark);
	
	
	
	$countrymid=$_POST['countrymid'];
	$rpcmic1=$_POST['rpcmic'];
	
	$earnigvalue=str_replace ("'","\'",$_POST['earnigvalue']);
	$earnigvalue=str_replace ('"','\"',$earnigvalue);
	
	$pointearningtype=str_replace ("'","\'",$_POST['pointearningtype']);
	$pointearningtype=str_replace ('"','\"',$pointearningtype);
	
	$pointvalue=str_replace ("'","\'",$_POST['pointvalue']);
	$pointvalue=str_replace ('"','\"',$pointvalue);
	
	$rpcurrency=str_replace ("'","\'",$_POST['rpcurrency']);
	$rpcurrency=str_replace ('"','\"',$rpcurrency);
	
	
	$rptaxincuded=str_replace ("'","\'",$_POST['rptaxincuded']);
	$rptaxincuded=str_replace ('"','\"',$rptaxincuded);
	
	$rptaxpercentage=str_replace ("'","\'",$_POST['rptaxpercentage']);
	$rptaxpercentage=str_replace ('"','\"',$rptaxpercentage);
	
	$rptaxname=str_replace ("'","\'",$_POST['rptaxname']);
	$rptaxname=str_replace ('"','\"',$rptaxname);
	
	$delete_checkbox_array1=$_POST['collegemid'];	

	foreach ($delete_checkbox_array1 as $one_by_one_sid1) 
			{
				$collegemid=$one_by_one_sid1;	
			  $eve1 = "INSERT INTO res_refferalpointcategory_detail (rpcmic,countrymid,earnigvalue,rptaxname,rptaxpercentage,rptaxincuded,rpcurrency,rpctype,rpremark,pointearningtype,pointvalue,collegemid) VALUES('$rpcmic1','$countrymid','$earnigvalue','$rptaxname','$rptaxpercentage','$rptaxincuded','$rpcurrency','Institute','$rpremark','$pointearningtype','$pointvalue','$collegemid')";
			
			if ($conn->query($eve1) === TRUE)
		{
			$last_id = $conn->insert_id;
			 
			
			$_SESSION['msg'] = "Record has been added successfully";
		}else{
			$_SESSION['msg1'] = "Error";
		}
			}
		
		
	
	
	
	
	
		 

	header("Location: refferalpointcategorydetail.php?id=$rpcmic1");
			
	
?>