<?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'];
	}
	$vfilingtype=$_POST['vfilingtype'];
	$vsubmissiontype=$_POST['vsubmissiontype'];
	$vreceiptno=$_POST['vreceiptno'];
	$visafilestatus=$_POST['visafilestatus'];
	$vsremarks=$_POST['vsremarks'];
	
	$vsdate=date("Y-m-d",strtotime($_POST['vsdate']));
	
	
	
	
	
		 $eve1 = "INSERT INTO res_visafilesubmission_detail (imid,stiqmid,vsaddedon,vsaddedby,vsupdatedon,vsupdatedby,vfilingtype,vsubmissiontype,vreceiptno,visafilestatus,vsremarks,vsdate) VALUES('$imid1','$stiqmid','$mdate1','$umid','$mdate1','$umid','$vfilingtype','$vsubmissiontype','$vreceiptno','$visafilestatus','$vsremarks','$vsdate')";
		
		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");
			}
			
	
?>