<?php
 	session_start(); 

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

	include("connect.php");
	
date_default_timezone_set("Asia/Kolkata");
$mdate1= date('Y-m-d H:i:s');
$mdate= date('d-m-Y');
$mdate2= date('d-m-Y H:i');
	$usermid = $_SESSION['umid'];
	
	//$cmname=$_POST['cmname'];
	if(isset($_POST['imid1']))
	{
	$imid1=$_POST['imid1'];
	}else{
	
	$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'];
	}
	}
	$clgappmid=$_POST['clgappmid'];
	$camdid=$_POST['camdid'];
			
			
		 $eve1 = "INSERT INTO res_collegeappman_master (imid, clgappmid,camdid,clgmaddedon,clgmaddedby,clgmupdatedon,clgmupdatedby) VALUES('$imid1','$clgappmid','$camdid','$mdate1','$usermid','$mdate1','$usermid')";
	
			
		if ($conn->query($eve1) === TRUE)
			{
				$last_id = $conn->insert_id;
	/* $delete_checkbox_array = $_POST['cdsdid'];
		$n=0;
			foreach ($delete_checkbox_array as $one_by_one_sid) 
			{
				$cdsdid = ($one_by_one_sid);
				if($cdsdid != 0)
				{
				 $eve2="insert into res_collegeappmanstep_detail (clgamid,cdsdid) values($last_id,'$cdsdid')";
				
					$re2 = mysqli_query($conn, $eve2);
				}
			} */
				
			}
			else
			{
				$_SESSION['msg1'] = "Error";
			}
			
			if($_SESSION['frompage']=='aplicationInquirydetailpage')
			{
				header("Location: applicationinquirydetail.php?id=$stiqmid");
			}else{
	header("Location: inquirydetail.php?id=$imid1&tab=student_application");
			}
			
	
?>