'); $_SESSION['msg'] = ""; } print ''; print ''; print ''; print '




'; if (isset($_SESSION['msg'])) { $len = strlen($_SESSION['msg']); } else { $len = 0; } if ($len > 0) { print('
' . $_SESSION['msg'] . '
Edit Course Information
'; print ''; if ($data_len > 0) { print ''; print ''; print ''; for ($i = 0; $i < $data_len; $i++) { print ''; $cname = explode(",", $data[$i]['cnamedesc']); print ''; print ''; } } else { print ''; print ''; print ''; } print ''; print '
Below are all courses found in the database:
' . $cname[0] . '
No courses found in the database.
'; } else if ($_GET['func'] == 'register') { $data = $_SESSION['coursesdata']; $data_len = count($data); $scheduledata = $_SESSION['scheduledata']; print ''; if (isset($_SESSION['msg'])) { $len = strlen($_SESSION['msg']); } else { $len = 0; } if ($len > 0) { print(''); $_SESSION['msg'] = ""; } print ''; print ''; print ''; print '
' . $_SESSION['msg'] . '
Register for Course(s)
'; print ''; if ($data_len > 0) { print ''; print '
Below are all courses found in the database:

'; print ''; for ($i = 0; $i < $data_len; $i++) { //check if the current course is already selected by this student $found = false; for ($j=0; $j < count($scheduledata); $j++) { if (strpos($data[$i]['cnamedesc'], $scheduledata[$j][0]) !== false) { $found = true; break; } } //display the course as checked or unchecked if ($found == true) { print '' . $data[$i]['cnamedesc'] . '
'; } else { print '' . $data[$i]['cnamedesc'] . '
'; } } print ''; print ''; print ''; } else { print ''; print ''; print ''; } print ''; print '

'; print '
No courses found in the database.
'; } else if ($_GET['func'] == 'editcourse') { $data = $_SESSION['coursesdata']; $teacherdata = $_SESSION['teacherscheduledata']; if (($data == null) || ($teacherdata == null)) { print ''; print ''; print ''; print ''; print ''; print '
Edit Course Information
Cannot get course information
'; return; } print ''; print ''; $len = strlen($_SESSION['msg']); if ($len > 0) { print(''); $_SESSION['msg'] = ""; } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; $sdate = explode("-", $data[7]); print ''; print ''; print ''; $edate = explode("-", $data[8]); print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if($data[3] == 0) { print ''; } else { print ''; } print ''; print ''; print ''; print ''; print '
' . $_SESSION['msg'] . '
Edit Course Information
*Course Name:
Course Description:
Course Status: '; print '
Course Fee:
*Start Date: -- (DD-MM-YYYY)'; print '
*End Date: -- (DD-MM-YYYY)'; print '
*Day [Time]:
*Room:
Room Description:
Teacher(s): '; for ($i=0; $i < count($teacherdata); $i++) { if ($teacherdata[$i]['assigned'] == true) { print '' . $teacherdata[$i]['lastfirstname'] . '
'; } else { print '' . $teacherdata[$i]['lastfirstname'] . '
'; } } print '
Active
Active

'; print '
'; } ?>