Welcome Guest, Not a member yet? Register   Sign In
redirect to same function
#1

[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);
  }


Messages In This Thread
redirect to same function - by El Forum - 04-13-2012, 02:06 AM
redirect to same function - by El Forum - 04-13-2012, 03:15 AM
redirect to same function - by El Forum - 04-13-2012, 05:46 AM
redirect to same function - by El Forum - 04-13-2012, 05:57 AM
redirect to same function - by El Forum - 04-13-2012, 06:05 AM
redirect to same function - by El Forum - 04-13-2012, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB