Location: PHPKode > projects > TimeSheet4dotProject > ts4dp/timesheet/getProjects.php
<?php
require_once('session.php');
require_once('global4app.php');
// get company id, do a query, print as a html select UI widget - and its done
// if no company id as request (get), then print error ... 
$htmlOutput = "";
if ($_POST['companyId'] == "")
{
	$htmlOutput = '<select id=projectName onChange=changeTask();><option id=0>No Projects</option></select>';
}
else
{
	$htmlOutput = '<select id=projectName style="{width:275}" onChange=changeTask();><option value=0>Select a Project</option>';
	//echo 'select * from projects where project_company = '. $_GET['companyId']; 
	$result = db_loadList('select * from projects where project_company = '. $_POST['companyId']);
	foreach($result as $row)
	{
		$htmlOutput = $htmlOutput .  '<option value='.$row['project_id'].'>'.$row['project_name'].'</option>';
	}
	$htmlOutput = $htmlOutput . '</select>';
	
}
echo ($htmlOutput);
?>
Return current item: TimeSheet4dotProject