USE SESSION VARIABLES.
In your controller setup:
function my_function() {
if(!empty($this->data)){
$this ->Session->write('search',$this->data['Model']['field']);
$search_string =$this->data['Model']['field'];
} else {
$search_string =$this ->Session->read('search');
}
$condition = array('Model.field_name'=>$search_string);
$search_data = $this->Model->find('all',array('conditions'=>$condition));
$this->set('search_data',$search_data);
}
/* in your view file use */
debug($search_data);
/* you can see the recordset, if debug mode is set to 2 or above. */
Hope this helps someone else as well.
Happy baking.
No comments:
Post a Comment