\<?php
session_start();
include('connect.php');
error_reporting(0);

if(isset($_POST["campusmid"]) && !empty($_POST["campusmid"])){
    //Get all state data
	$campusmid=$_POST['campusmid'];

	
	 $eve="SELECT * FROM res_commissiontermintake_detail WHERE commissionmid in (select commissionmid from res_commissioncampus_detail where  ccampusmid = $campusmid ) ";
	$re = mysqli_query($conn, $eve);
//echo '<option value="0">'.$eve.'</option>';
    //Count total number of rows
    if(mysqli_num_rows($re) > 0)
	{
		echo '<option value="0">Select</option>';
		
		
        while($rt = mysqli_fetch_assoc($re))
		{
			/* $coursemid=$rt['coursemid'];
			$_SESSION['selectedcourse']=$coursemid; */
			$ctistartmonth=$rt['ctistartmonth'];
			
			$ctistartyear=$rt['ctistartyear'];
			$ctiendmonth=$rt['ctiendmonth'];
			$ctieendyear=$rt['ctieendyear'];
			
			$ctidid =$rt['ctidid'];
			if(isset($_SESSION['ctidid']) && $_SESSION['ctidid']== $ctidid )
			{
			
            echo '<option value="'.$ctidid.'" selected>'.$ctistartmonth.','.$ctistartyear.' - '.$ctiendmonth.','.$ctieendyear.'</option>';
			}else{
				 echo '<option value="'.$ctidid.'" >'.$ctistartmonth.','.$ctistartyear.' - '.$ctiendmonth.','.$ctieendyear.'</option>';
			}
        }
    }else{
        echo '<option value="0">Select </option>';
    }
}
?>
