// die(); $validate = new Validate(); $validation = $validate->check($_POST, array('position' => array('field_name' => 'Position', 'required' => true), 'date' => array('field_name' => 'Session Date', 'required' => true), 'text' => array('field_name' => 'Report Text', 'required' => true), 's' => array('field_name' => 'Session ID', 'required' => true))); if ($validation->passed()) { try { $r->addReport(array('student_cid' => Input::get('cid'), 'mentor_cid' => $user->data()->id, 'report_type_id' => Input::get('type'), 'position_id' => Input::get('position'), 'submitted_date' => date("Y-m-d"), 'session_date' => Input::get('date'), 'text' => Input::get('text'))); $reportID = $r->getLatestID("reports"); if (Input::get('slider')) { foreach (Input::get('slider') as $slideID => $slideVal) { if ($slideVal > 0) { $r->addSliderAnswers(array('report_id' => $reportID, 'slider_id' => $slideID, 'value' => $slideVal)); } } } $s = new Sessions(); $sess = $s->edit(['report_id' => $reportID], [['id', '=', Input::get('s')]]); $r->addCard(array('cid' => Input::get("cid"), 'card_type' => 0, 'link_id' => $reportID, 'submitted' => date('Y-m-d H:i:s'))); Session::flash('success', 'Report Added'); Redirect::to('./view_student.php?cid=' . Input::get('cid') . '#r' . $reportID); } catch (Exception $e) { die($e->getMessage()); } } else { echo ' <div class="col-md-6 col-md-offset-3"> <div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title">The following errors occured:</h3> </div> <div class="panel-body">'; foreach ($validation->errors() as $error) {