How to fix status code 303 in codeigniter?

Viewed 882

I am working on CI 3 when I post form data and insert into database then form a value that has been successfully save and I am also getting the last insert through $insert_id = $this->db->insert_id() following example as mention below:

$data = array(
    'name'  =>  $this->input->post('name'),
    'email' =>  $this->input->post('email'),
    'password'  =>  sha1($this->input->post('cpassword')),
    'confirm_id' => sha1($this->input->post('email')),
    'created_at' => date('Y-m-d H:i:s')
);
$success = $this->db->insert('instructor', $data);
$insert_id = $this->db->insert_id($success);
if($success == true)
{
    $instructorData = $this->instructor_m->get_instructorData($insert_id);
    $this->session->set_userdata('InstloginuserId',$instructorData->instructorID);
    redirect(base_url('board'));
}
else
{
    $this->session->set_flashdata('message', $this->lang->line('fail'));
    redirect(base_url('register'));
}

image

If success condition is true then it redirects to board page but it throws status code: 303 I don't know why? Please help me to solve this.

1 Answers

The Session Library has been completely re-written in CodeIgniter 3 and now comes with a bunch of new features, but that also means that there are changes that you should make.

Read the Step 6: Update your Session library usage from CodeIgniter | Upgrading from 2.2.x to 3.0.x.

Related