Clear form data after success codeigniter using php not jquery

前端 未结 2 1327
面向向阳花
面向向阳花 2021-01-23 01:22

I have a registration form. after success i want to remove set_value value and unset all posted value.

view.php



        
2条回答
  •  时光取名叫无心
    2021-01-23 02:03

    You can refresh page on success :

    $this->load->helper(array('form', 'url'));
    
            $this->load->library('form_validation');
            $this->form_validation->set_rules('username', 'Username', 'required');
            $this->form_validation->set_rules('password', 'Password', 'required');
            if ($this->form_validation->run() == FALSE){
                    $data['msg']='Please fill all field';
    
            }else{
                    $data['msg']='success';                
                    redirect($_SERVER['REQUEST_URI'], 'refresh');                 
            }
            $this->load->view('view',$data);
    

提交回复
热议问题