<div align="center" class="control-group">
		<div class="controls">  
			<button type="button" class="btn btn-danger" id="remove_secondary_school" disabled>Remove Secondary School</button>
			<button type="button" class="btn btn-success" id="add_secondary_school">Add Secondary School</button>
		</div>	
	</div>
	<!-- End of Secondary School Add Button -->
	<br ><br >
	<hr>
	
	<!-- Beginning of O-level details -->
	<div class="row-fluid">
		<h4 align="center">O Level Details</h4>
		<?php 
$sql_olevel = "SELECT * FROM o_level_details WHERE applicant_id=" . $session->applicant_id;
$result_olevel = Olevel::find_by_sql($sql_olevel);
//print_r($result_olevel);
$no_arr = array();
$year_arr = array();
$type_arr = array();
$centre_arr = array();
$olevel_detail = array();
$olevels = array();
if (!empty($result_olevel)) {
    $o = 1;
    foreach ($result_olevel as $row) {
        $no_arr[$o] = 'exam_no_' . $o;
        $year_arr[$o] = 'exam_year_' . $o;
        $type_arr[$o] = 'exam_type_' . $o;
        $centre_arr[$o] = 'exam_centre_' . $o;
        $olevel_detail[$o] = $row;
    $year = 'award_year_' . $a;
    if ($_POST[$prize] == '') {
        continue;
    }
    /*temporary array for Awards and Prizes*/
    $temp_arr = array('prize' => $_POST[$prize], 'awarding_body' => $_POST[$award_body], 'year' => $_POST[$year]);
    $award_record[$a] = $temp_arr;
}
$user->academic_prizes = serialize($award_record);
/*obatin applicant id from session*/
$user->applicant_id = $session->applicant_id;
if (!$user->save()) {
    $error_academic_prizes = true;
}
/*update O level details*/
$olevel = new Olevel();
//checks if the user has removed second sitting and thereby deletes the second sitting from the db
if ($_POST['exam_no_2'] == '') {
    //get the id of the second sitting
    $resultsecondsitting = $olevel->find_by_sql("SELECT o_level_id FROM o_level_details WHERE applicant_id='" . $session->applicant_id . "' ORDER BY o_level_id DESC");
    $resultsecondsitting = array_shift($resultsecondsitting);
    if (sizeof($resultsecondsitting) > 1) {
        $olevel->o_level_id = $resultsecondsitting->o_level_id;
        $olevel->delete();
    }
}
$olevel->db_fields = array('o_level_id', 'applicant_id', 'subject_grade', 'exam_number', 'exam_year', 'exam_centre', 'exam_type_id');
$o = 1;
/*loop for number of Exam sitting*/
while ($o <= $_POST['num_of_exam_sitting']) {
    $no = 'exam_no_' . $o;