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

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

//$branchmid = array('1','2');
$placeholders = implode(',', $branchmid);
$aa1 = '';
if(!in_array('All',$branchmid))
{
	$aa1 = "and branchmid in ($placeholders)";
}

//$departmentmid = 'All';
$departmentmid = $_POST['departmentmid'];


 //$departmentmid = array("1", "2");
 $placeholders1 = implode(',', $departmentmid);
$aa2 = '';
if(!in_array('All',$departmentmid))
{
	 $aa2 = "and departmentmid in ($placeholders1)";
}



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

    $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="0">Select User</option>';
        while($rt = mysqli_fetch_assoc($re)){
			$umid = $rt['umid'];
			$eve1 = "select umid from res_meetingallocation_detail where umid=$umid  and meetingmid=$meetingmid";
			$re1 = mysqli_query($conn, $eve1);
echo '<option value="'.$eve1.'">'.$eve1.'</option>';
    if(mysqli_num_rows($re1) > 0)
	
{
	
            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>';
    }
}
?>