function save() { $education = new Education(); $education->staff_id = $this->staff_id; $education->edu_year = $this->input->post('edu_year'); $education->edu_gelar = $this->input->post('edu_gelar'); $education->edu_name = $this->input->post('edu_name'); if ($education->save()) { $this->session->set_flashdata('message', 'Education successfully created!'); redirect('staffs/' . $this->staff_id . '/educations/index'); } else { // Failed $education->error_message('custom', 'Field required'); $msg = $education->error->custom; $this->session->set_flashdata('message', $msg); redirect('staffs/' . $this->staff_id . '/educations/add'); } }