<?php

//include the headers resources
require_once('includes/functions.php');



if($_REQUEST)
{
	$id 	= $_REQUEST['value'];
	$query = "SELECT c.id as cid, c.title as course_title, c.department_id , d.id as did, d.title as department_title
						  FROM courses c, departments d 
						  
						  WHERE 
						  d.id = c.department_id
						  
						  AND c.department_id = '$id'
						  
						  ORDER BY course_title";
	$results = mysqli_query(dbc(), $query);?>
	
	<select  class="form-control" name="sub_course"  id="sub_course_id">
	<option value="0">--Select Course --</option>
	<?php
	while ($rows = mysqli_fetch_assoc(@$results))
	{?>
		<option value="<?php echo $rows['cid'];?>"><?php echo $rows['course_title'];?></option>
	<?php
	}?>
	</select>	
	
<?php	
}
?>

