function save_reply($topic_id, $id = FALSE, $type = FALSE) { if ($_POST) { if ($_POST['captcha'] != $this->session->userdata('captcha')) { set_notify('error', 'กรอกรหัสไม่ถูกต้อง'); redirect($_SERVER['HTTP_REFERER']); } else { if ($type == "edit") { $webboard_answer = new Webboard_answer($id); } else { $webboard_answer = new Webboard_answer(); } $_POST['webboard_quiz_id'] = $topic_id; $_POST['user_id'] = $this->session->userdata('id'); $webboard_answer->ip = $this->input->ip_address(); $webboard_answer->from_array($_POST); $webboard_answer->save(); set_notify('success', 'Save Data Complete'); } } $site_redirect = "webboards/view_topic/" . $topic_id; redirect($site_redirect); }