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

if(isset($_POST["imid"]) && !empty($_POST["imid"])){
    //Get all state data
	$imid=$_POST['imid'];
	//$imid=74;
	
	$eve = "select * from res_studentinquiry_detail where imid=".$imid;
//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($rt1 = mysqli_fetch_assoc($re))
		{
			$siprefferservice=$rt1['siprefferservice'];$siprefferedsubservice=$rt1['siprefferedsubservice'];
																			
		 $eves = "select * from res_subservice_master where subservicemid = $siprefferedsubservice ";
		$res = mysqli_query($conn, $eves);
		
		while($rts = mysqli_fetch_assoc($res))

		{
			$subservicename = $rts['subservicename'];
		}
		
		
		$siprefferedcountry=$rt1['siprefferedcountry'];
		
		$evec = "select * from  res_country_master where countrymid = $siprefferedcountry ";
		$rec = mysqli_query($conn, $evec);
		
		while($rtc = mysqli_fetch_assoc($rec))

		{
			$countryname = $rtc['countryname'];
		}
		
		
		$stiqmid =$rt1['stiqmid'];
			$inquirydate=date("d-m-Y",strtotime($rt1['inquirydate']));
			
			echo "<option value='$stiqmid'>$siprefferservice - $subservicename - $countryname ($inquirydate)</option>";
			 
        }
    }else{
        echo '<option value="0">No Data Found </option>';
    }
}
?>
