[eluser]jon29[/eluser]
Hi sorry if this is a stupid question just want to check this isn't a bad practice,
In order that the flash data triggers at the next page load to confirm database had been updated, I need to use redirect to go back and reload the function, just checking that redirecting to the top of the same function isn't bad practice, code is below thanks
Code:
public function pages ()
{
if (isset($_POST['content_1'])){
$this->load->library('form_validation');
$this->form_validation->set_rules('content_1','content_1', 'trim|required');
if($this->form_validation->run() == FALSE)
{
}
else {
$updated = $this->cms->update_pages();
echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;echo $updated;
if (($updated == 1) ? $this->session->set_flashdata('Updated', 'Updated'): NULL);
redirect ('admin/pages/'.$this->uri->segment(3));
}
}
$this->load->helper('form');
$data['style'] = array('css/admin/pages.css');
$index = $this->uri->segment(3);
$data['rows'] = $this->data_model->get_page($index);
$this->load->view('admin/pages',$data);
}