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

if(isset($_POST["coursemid"]) && !empty($_POST["coursemid"])){
    //Get all state data
	$coursemid=$_POST['coursemid'];
	$_SESSION['selectedcoursemid']=$_POST['coursemid'];
	$selectedcountrymid=$_SESSION['selectedcountrymid'];
	 $eve="SELECT collegemid,cmname FROM res_college_master WHERE countrymid=$selectedcountrymid and collegemid in(select collegemid from res_course_master where coursemid=$coursemid)";
	$re = mysqli_query($conn, $eve);

    //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; */
			$collegemid=$rt['collegemid'];
			
			$cmname=$rt['cmname'];
			
            echo '<option value="'.$collegemid.'">'.$cmname.'</option>';
        }
    }else{
        echo '<option value="0">Select </option>';
    }
}
?>
