<?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");
include("mylibrary.php");
	
	//$cmname=$_POST['cmname'];
	
	 $stiqmid=$_POST['stiqmid'];
	$eve2 = "select imid from res_studentinquiry_detail where stiqmid=$stiqmid";
	$re2 = mysqli_query($conn, $eve2);
	while($rt2 = mysqli_fetch_assoc($re2))

	{
		$imid1 = $rt2['imid'];
	}
	
	$umid1=$_POST['umid'];
	$ccmessage=checkvalidstring($_POST['ccmessage']);
	$ccwith=checkvalidstring($_POST['ccwith']);
	
	
	
	
		 $eve1 = "INSERT INTO res_coachingcommunication_detail (imid,stiqmid,ccmessage,ccaddedon,ccaddedby,ccupdatedon,ccupdatedby,umid,ccwith) VALUES('$imid1','$stiqmid','$ccmessage','$mdate1','$umid','$mdate1','$umid','$umid1','$ccwith')";
		
		
		if ($conn->query($eve1) === TRUE)
		{
			
			
		}
		else
		{
			$_SESSION['msg1'] = "Error";
		}
	
	header("Location: coachinginquirydetail.php?id=$stiqmid");
			
	
?>