why after use of redirect in codeigniter i have this error:
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many
redirects.
if use of this: redirect('admin/hotel/insert', 'refresh');, refresh page to be non-stop, burst.
what do i do?
my codes(function) in controller hotel:
function insert(){
$this->load->view('admin/hotel_submit_insert');
$today = jgmdate("j F Y");
$data = array (
'name' => $this->input->post('name', TRUE),
'star' => $this->input->post('star', TRUE),
'address' => $this->input->post('address', TRUE),
'number_phone' => $this->input->post('number_phone', TRUE),
'fax' => $this->input->post('fax', TRUE),
'site' => $this->input->post('site', TRUE),
'email' => $this->input->post('email', TRUE),
'useradmin' => $this->input->post('useradmin', TRUE),
'date' => $today ,
);
$this->db->insert('hotel_submits', $data);
redirect('admin/hotel/insert'); // after use of this
}
With respect
Okay, so you need to make sure that the insert happens only once.
So, You need to check if the post data is available before you run a redirect. What is happening here is that the code keeps inserting data and redirecting the page.
}