<?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('Y-m-d');
$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	
	include("connect.php");

	
	//$cmname=$_POST['cmname'];
	$imid1=$_POST['imid'];
	$iieltstestname=$_POST['iieltstestname'];
	$iieltsread=0;
	$iieltswrite=0;
	$iieltsspeak=0;
	$iieltslisten=0;
	$iieltsverbalreasoning=0;
	$iieltsquantitativereasoning=0;
	$iieltsanalyticalwriting=0;
	$iieltsenglish=0;
	
		$iieltsverbalreasoning=$_POST['iieltsverbalreasoning'];
	$iieltsquantitativereasoning=$_POST['iieltsquantitativereasoning'];
	$iieltsanalyticalwriting=$_POST['iieltsanalyticalwriting'];
	$iieltsoverall=$_POST['iieltsoverall'];
	$iieltsminscore=$_POST['iieltsminscore'];
	
	$iieltsreportnumber=$_POST['iieltsreportnumber'];
	
	$iieltstestcenter=$_POST['iieltstestcenter'];
	
	$iieltsdexamdate=implode('-', array_reverse(explode('-', $_POST['iieltsdexamdate'])));
	$iieltsdvalidupto=implode('-', array_reverse(explode('-', $_POST['iieltsdvalidupto'])));
	
	
	if($mdate>$iieltsdvalidupto)
	{
		$iieltsdstatus="Invalid";
	}
	else
	{
		$iieltsdstatus="Valid";
	}
	
	$iieltsaddedby=$_SESSION['umid'];
	$iieltsaddedtype=$_SESSION['utype'];
		
	
		$eve1 = "INSERT INTO res_inquiryielts_detail (imid,iieltsread, iieltswrite, iieltsspeak, iieltslisten, iieltsreportnumber, iieltsdexamdate,iieltsdvalidupto,iieltsdstatus,iieltsaddedby,iieltsaddedtype,iieltsaddedon,iieltstestname,iieltstestcenter,iieltsupdatedon,iieltsupdatedby,iieltsoverall,iieltsverbalreasoning,iieltsquantitativereasoning,iieltsanalyticalwriting,iieltsmaths,iieltsenglish,iieltsminscore,iieltstype) VALUES('$imid1','$iieltsread','$iieltswrite','$iieltsspeak','$iieltslisten','$iieltsreportnumber','$iieltsdexamdate','$iieltsdvalidupto','$iieltsdstatus',$iieltsaddedby,'$iieltsaddedtype','$mdate1','$iieltstestname','$iieltstestcenter','$mdate1','$iieltsaddedby','$iieltsoverall','$iieltsverbalreasoning','$iieltsquantitativereasoning','$iieltsanalyticalwriting','$iieltsmaths','$iieltsenglish','$iieltsminscore','Aptitude')";
		
			
		if ($conn->query($eve1) === TRUE)
			{
				/* $eve11 = "update res_inquiry_master set imstatus='Inquiry Details' where imid=$imid1";
				$re11 = mysqli_query($conn, $eve11); */
				$_SESSION['msg'] = "Record has been added successfully";
			}
			else
			{
				$_SESSION['msg1'] = "Error";
			}
	header("Location: inquirydetail.php?id=$imid1&tab=student_education");
			
	
?>