<?php
require_once("includes/initialize.php");
global $database;

$output = '';
$output =  "Hello world 123!";

// if(isset($_POST['semester']))
//     {
		$dept = $_POST['department'];
		$level = $_POST['level'];
		$session = $_POST['session'];
		$semester = $_POST['semester'];
		
        $_SESSION['department'] =  $department;
        $_SESSION['level'] =  $level;
        $_SESSION['session'] =  $session;
        $_SESSION['semester'] =  $semester;
		echo $dept.' '.$level.' '.$semester;
		$query = "
			SELECT course_code, course_title, course_unit FROM tbl_courses 
			WHERE department = '$dept' AND  level = '$level' AND semester='$semester'";
			
			$sql = mysql_query($query);
			$output .= '<option value="">Select Course</option>';
		while ($rows = mysql_fetch_array($sql))
		{
		    $output .= '<option value="'.$row['course_code'].'">'.$row['course_code']." : ".$row['course_title'].'</option>';
		}
		echo $output;
// 	}
// 	else{ echo "Error 442";}

?>