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

if(isset($_POST["collegemid"]) && !empty($_POST["collegemid"])){
    //Get all state data
	$collegemid=$_POST['collegemid'];
	if($collegemid == 'All')
	{
		$tt1 = '';
	}else{
		$tt1 = 'WHERE collegemid = $collegemid';
	}
	
	 $eve="SELECT campusname,ccampusmid FROM res_collegecampus_master $tt1";
	$re = mysqli_query($conn, $eve);

    //Count total number of rows
    if(mysqli_num_rows($re) > 0)
	{
		
		echo '<option value="All">All</option>';
        while($rt = mysqli_fetch_assoc($re))
		{
			/* $coursemid=$rt['coursemid'];
			$_SESSION['selectedcourse']=$coursemid; */
			$ccampusmid=$rt['ccampusmid'];
			
			$campusname=$rt['campusname'];
			if($_SESSION['campusmid'] == $ccampusmid)
			{
			
            echo '<option value="'.$ccampusmid.'" selected>'.$campusname.'</option>';
			}else{
				 echo '<option value="'.$ccampusmid.'">'.$campusname.'</option>';
			}
        }
    }else{
        echo '<option value="0">Select </option>';
    }
}
?>
