public function request_course($course_id) { require_once 'models/course_model.php'; $course_model = new course_model(); $student_id = $_SESSION['student_id']; // student courses $courses = $course_model->get_student_courses($student_id); // cuorse prerequesites $preCourses = $course_model->get_course_prerequisites($course_id); $accept = $this->check($preCourses, $courses); if ($accept) { $course_model->insert_student_course($student_id, $course_id); header('Location: ' . $this->base_url('course/courses')); } else { require_once 'views/course_prequisites.php'; } }