<?php
	include(__DIR__.'/../includes/sysinit.php');
	$html	= '<option value="0">Select Building</option>';
	if ($_POST['id'])
	{					
		$sql = 'select building_id, building_name, area_name  
				from building 
				inner join area on area.area_id = building.area_id 
				where client_id = '.$_POST['id'];
		$rows = $sableDB->getRows($sql);
		foreach($rows as $row) 
		{
			$html .= '<option value="'.$row['building_id'].'">'.$row['building_name'].' ['.$row['area_name'].']</option>';
		}
	}
	$data['output_list'] = $html;
	SableSystem::ajaxFillField($html, $_POST['field']);