I am trying to get segment (3) and insert it into my new table with my session ID but im stuck .. any idea
Model
function old_report_create()
{
$reportID = $this->input->post('ReportID');
$userID_staff = $this->session->userdata('StaffID');
if (isset($reportID) && isset($userID)) {
$new_read = array(
'ReportID' => $reportID,
'StaffID' => $userID_staff,
);
return $this->db->insert('Read_Report', $new_read);
}
return FALSE;
}
View
<?= form_open('main/add_old_report'); ?>
<?= form_hidden('ReportID', $this->uri->segment(3)); ?>
<p><input type="submit" value="Read Report"/></p>
</form>
Controller
function add_old_report()
{
if ($query = $this->report_model->old_report_create()) {
$this->session->set_flashdata('messagetwo', 'You marked report as read');
redirect('main/comments/' . $_POST['ReportID']);
} else {
$this->session->set_flashdata('messagetwo', 'Sorry not this time');
redirect('main/comments/' . $_POST['ReportID']);
}
}