<?php
session_start();
include('connect.php');
error_reporting(0);
$usermid = $_SESSION['umid'];
if(isset($_POST["branchmid"]) && !empty($_POST["branchmid"])){
    //Get all state data
	$branchmid=$_POST['branchmid'];
	//$branchmid=1;
	if($_SESSION['utype'] == 'admin')
	{
	$eve="SELECT imid,ipname,ipmiddlename FROM res_inquiry_master WHERE inqbranch=$branchmid";
	}else{
		$eve="SELECT imid,ipname,ipmiddlename FROM res_inquiry_master WHERE imid in (select imid from res_counsellor_detail where counsellorid=$usermid)";
	}
//echo '<option value="'.$eve.'">'.$eve.'</option>';
	$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))
		{
			$imid=$rt['imid'];
			/* $_SESSION['selectedcourse']=$cnmid;
			$collegemid=$rt['collegemid']; */
			$ipname=$rt['ipname'];
			$ipmiddlename=$rt['ipmiddlename'];
			$ipsurname=$rt['ipsurname'];
			
            echo '<option value="'.$imid.'">'.$ipname." ".$ipmiddlename." ".$ipsurname.'</option>';
        }
    }else{
        echo '<option value="0">No Data Found </option>';
    }
}
?>
