Codeigniter Form Validation - how to unset form values after success?

前端 未结 8 741
天涯浪人
天涯浪人 2020-12-23 20:36

I realise this request goes against the example provided in the CI documentation (which advises a separate \'success\' page view), but I would like to reutilise a given form

8条回答
  •  佛祖请我去吃肉
    2020-12-23 21:31

    Hope this would be helpful. Finally I understand the whole concept of the extending the library. All you need to do is
    Step 1: In this directory "application/libraries/" create a file named "MY_Form_validation.php" with the following php code

    _field_data);    
        }
    }
    

    Step 2: Then use the function "unset_field_data()" in you controller. for example below:

        if ($this->form_validation->run())
        {
            $this->item_model->add_item($this->input->post('name'));
            $success = true;
    
            $this->form_validation->unset_field_data();
        }
    

提交回复
热议问题