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

if(isset($_POST["countrymid"]) && !empty($_POST["countrymid"]) && isset($_POST["collegetypemid"]) && !empty($_POST["collegetypemid"]) && isset($_POST["cnmid"]) && !empty($_POST["cnmid"])){
  
	$cnmid=$_POST['cnmid'];
	/* $cnmid='All'; */
	if($cnmid == 'All')
	{
		$tt = '';
	}else{
		$tt = "and collegemid in(select collegemid from res_course_master where cnmid=$cnmid)";
	}
	
	$countrymid=$_POST['countrymid'];
	
	
	$collegetypemid=$_POST['collegetypemid'];
	
	if($collegetypemid == 'All')
	{
		$tt1 = '';
	}else{
		$tt1 = "and collegetypemid='$collegetypemid'";
	}
	
	 $eve="SELECT collegemid,cmname FROM res_college_master WHERE countrymid=$countrymid $tt $tt1";
	$re = mysqli_query($conn, $eve);
/* echo '<option value="0">.'.$eve.'</option>'; */
    
    if(mysqli_num_rows($re) > 0)
	{
		echo '<option value="All">All</option>';
        while($rt = mysqli_fetch_assoc($re))
		{
			/* $coursemid=$rt['coursemid'];
			$_SESSION['selectedcourse']=$coursemid; */
			$collegemid=$rt['collegemid'];
			
			$cmname=$rt['cmname'];
			if($_SESSION['collegemid'] == $collegemid)
			{
			
            echo '<option value="'.$collegemid.'" selected>'.$cmname.'</option>';
			}else{
				echo '<option value="'.$collegemid.'">'.$cmname.'</option>';
			}
        }
    }else{
        echo '<option value="All">All </option>';
    }
}
?>
