Welcome Guest, Not a member yet? Register   Sign In
Preventing double post data being resent
#3

[eluser]Michael Wales[/eluser]
On most all of my forms, I use the same controller for displaying and processing the data, redirecting away upon success.

Code:
$this->load->library('validation');
// My Rules
// My Fields
if ($this->validation->run()) {
  // Perform my database shizzle
  redirect('view_this_data');
} else {
  $this->load->view('display_input_form');
}

A refresh in these circumstances would simply refresh the displayed data.

If you are wanting to load a blank form up again, you could always just toss a middle-man in there, like so:

Code:
$this->load->library('validation');
// My Rules
// My Fields
if ($this->validation->run()) {
  // Perform my database shizzle
  $this->session->set_flashdata('return_path', $this->uri->uri_string());
  redirect('clear_post');
} else {
  $this->load->view('display_input_form');
}

function clear_post() {
  redirect($this->session->flashdata('return_path'));
}

Kind of a round-about way...


Messages In This Thread
Preventing double post data being resent - by El Forum - 09-19-2007, 02:30 AM
Preventing double post data being resent - by El Forum - 09-19-2007, 02:41 AM
Preventing double post data being resent - by El Forum - 09-19-2007, 06:40 AM
Preventing double post data being resent - by El Forum - 09-19-2007, 07:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB