php - How to store multiple params on Session -


i'm using this:

        if(!empty($this->request->data['cd_pedido'])){             $this->set('filtrobusca',array('cd_pedido'=>$this->request->data['cd_pedido']));         }else if(!empty($sessaocdpedido)){             $this->set('filtrobusca',array('cd_pedido'=>$sessaocdpedido));         }          if(!empty($this->request->data['cd_seq_pedido'])){             $this->set('filtrobusca',array('cd_seq_pedido'=>$this->request->data['cd_seq_pedido']));         }else if(!empty($sessaocdseqpedido)){             $this->set('filtrobusca',array('cd_seq_pedido'=>$sessaocdseqpedido));         } 

and when : $this->session->read('filtrobusca') or $_session['filtrobusca']

shows last checkbox selected. can tell me i'm doing wrong?

result $_session['filtrobusca']

array ( [cd_pedido] => 7 )

image of checkboxs:

enter image description here

you erasing array when setting in second 'if' condition. may consider using array buffer data want put in session, put @ once :

$filtrobusca = array(); if(!empty($this->request->data['cd_pedido'])){     $filtrobusca['cd_pedido'] = $this->request->data['cd_pedido']; }else if(!empty($sessaocdpedido)){     $filtrobusca['cd_pedido'] = sessaocdpedido; }  //do same thing other 1 

then put $filtrobusca in session :

$this->set('filtrobusca',$filtrobusca); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -