php - Not able to clear the variables in codeigniter -


this controller:-

public function home() {     if($this->session->userdata('id')) {         $this->header();         $this->load->model('admincon');         $e = $this->admincon->select();         $data['e'] = $e;         $this->load->view('admin/home',$data);     } else {         $this->index();     } } 

in view page of function home() there form submitted through function subques() function here:-

public function subques() {     if($this->session->userdata('id')) {         $tp=$this->input->post('box1',true);         $s=$this->input->post('box',true);         $t=$this->input->post('t',true);         $a=$this->input->post('a',true);         $b=$this->input->post('b',true);         $c=$this->input->post('c',true);         $d=$this->input->post('d',true);         $n=$this->input->post('n',true);             $this->load->model('admincon');         $this->admincon->subque($s,$t,$a,$b,$c,$d,$n,$tp);          $this->home();     } else {         $this->index();     } } 

but after submitting values database when user redirected page if click on refresh button previous data store database time. how solve problem.

i mean how clear variables after use them.

user redirect() instead of $this->home()

 public function subques() {    if($this->session->userdata('id'))    {        $tp=$this->input->post('box1',true);        $s=$this->input->post('box',true);        $t=$this->input->post('t',true);        $a=$this->input->post('a',true);        $b=$this->input->post('b',true);        $c=$this->input->post('c',true);        $d=$this->input->post('d',true);        $n=$this->input->post('n',true);            $this->load->model('admincon');        $this->admincon->subque($s,$t,$a,$b,$c,$d,$n,$tp);         redirect('controller_name/home');   }    else    {        redirect('controller_name/index');    } } 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -