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

if(isset($_POST["branchmid"]) && !empty($_POST["branchmid"])){
    //Get all city data
   
//$branchmid = 'All';
 $branchmid = $_POST['branchmid'];
 $batchmid = $_POST['batchmid'];


 $eve="SELECT * FROM res_user_master WHERE utype not in ('agent','referral','admin') and ustatus='Approved' and  branchmid = $branchmid  ";

    $re = mysqli_query($conn, $eve);
//echo '<option value="'.$eve.'">'.$eve.'</option>';
    //Count total number of rows
    if(mysqli_num_rows($re) > 0)
{
echo '<option value="All">All</option>';
        while($rt = mysqli_fetch_assoc($re)){
			
			$eve2 = "select umid from res_batch_master where batchmid = $batchmid";
			$re2 = mysqli_query($conn, $eve2);
//echo '<option value="'.$eve.'">'.$eve2.'</option>';
    //Count total number of rows
     while($rt2 = mysqli_fetch_assoc($re2)){
		if($rt['umid'] == $rt2['umid'])
{
            echo '<option value="'.$rt['umid'].'" selected>'.$rt['ufullname'].'</option>';
}else{
	echo '<option value="'.$rt['umid'].'" >'.$rt['ufullname'].'</option>';
}

        }
    }
}else{
        echo '<option value="0">No Data Found</option>';
    }
}
?>