<?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'];
	 if(isset($_POST['imid1']))
	{
	$imid1=$_POST['imid1'];
	}
	
	$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'];
	}
	$countrymid=$_POST['countrymid'];
	
	$statemid=$_POST['statemid'];
	$citymid=$_POST['citymid'];
	$madate=date("Y-m-d",strtotime($_POST['madate']));
	$centre=$_POST['centre'];
	
	
	
	
		 $eve1 = "INSERT INTO res_medicalappointment_detail (imid,countrymid, statemid,citymid,stiqmid,madate,maddedon,maddedby,mupdatedon,mupdatedby,centre) VALUES('$imid1','$countrymid','$statemid','$citymid','$stiqmid','$madate','$mdate1','$umid','$mdate1','$umid','$centre')";
		
		if ($conn->query($eve1) === TRUE)
		{
			
			$_SESSION['msg'] = "Record has been added successfully";
		}
		else
		{
			$_SESSION['msg1'] = "Error";
		}

	if($_SESSION['frompage']=='visaInquirydetailpage')
			{
				header("Location: visainquirydetail.php?id=$stiqmid");
			}else{
	header("Location: inquirydetail.php?id=$imid1&tab=student_visa");
			}
			
	
?>