Welcome Guest, Not a member yet? Register   Sign In
search page problem
#1

[eluser]dimis[/eluser]
I have a search page.
I have a input text searchfield.
I use pagination of CI.
I want to have at all pages of pagination the value of searchfield.
So I use this code
Code:
post=$this->input->post('searchfield');

        if (!empty($post))
        {
           $this->session->
set_flashdata('searchfield',$this->input->post['searchfield']);
            $mysearch=$this->input->post('searchfield');
        
        }
        else
        {

            $this->session->set_flashdata('searchfield',  flashdata('searchfield'));
            $mysearch= $this->session->flashdata('searchfield');

        }
but it does not seems to work.
The flashdata is not there.
How can I put the input text searchfield value for all the pages of pagination?
Dimis
#2

[eluser]JoostV[/eluser]
Flashdata is only available on the next page reload.

You might be better off saving the string in regular session, and display it in the view directly. This

Code:
// Store search input in session
$this->data['mysearch'] = ;
$this->session->set_userdata('searchfield', $this->data['mysearch']);

// Pass search input to view
$this->load->view('some_view', $this->data);




Theme © iAndrew 2016 - Forum software by © MyBB