Welcome Guest, Not a member yet? Register   Sign In
Best way to prevent repopulation form after success submit?
#1

(This post was last modified: 03-08-2018, 08:47 AM by minsk832.)

Hello,

I use set_value etc in my forms. After I submit a form and data saved to database I wan't to prevent repopulation the form. Is there a better way then always create 2 forms in html view with checking for successful submitting and one time without set_value helpers?

I tried to

PHP Code:
unset($_POST); 

but that don't work.

My solution until now:

Create class MY_Form_validation and add a function:

PHP Code:
public function clear_field_data()
{
 
   $_POST = array();
 
   $this->_field_data = array();
 
   return $this;


In Controller after success:

PHP Code:
$this->form_validation->clear_field_data(); 
Reply


Messages In This Thread
Best way to prevent repopulation form after success submit? - by minsk832 - 03-08-2018, 08:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB