Welcome Guest, Not a member yet? Register   Sign In
Back to the search result

Hi everyone !

My question is simple : how can I design a « back to the search result » button ?
I created a search result who display a list of link.
How to do when a user go to one link and want to go back to his search result ?

I saw that I can use JS :
but I would like to do it in CI.

Someone can help me ?
Thank you a lot !

Nobody can help me ?

put this into page load part (somewhere in controller code)
$this->session->set_flashdata('previus_adress', $my_url);

and put this code into controller function that displays the one result item

echo '<a href="'..'">Go Back to results</a>'

tell me if anything is wrong, I havent tested this code yet, but in theory,
if your search info is passed as url (ex. http:/localhost/index.php/search/trololo)
this code will in first part:
using url helper get the current url, and using session library will put that url into flash data as 'previus_adress'
and in the other part it will retrive that flash data from session using the session library
and echo it onto page in form of normal link

for the question why i use flashdata instead of normal session data is because flash data will exist only for one load, so no need to clear anything if user decides not to return back to result list

Or just



Thank you very much for you answer.
I'll try both.

I tried what you said nagata but unfortunately it doesn't work, it redirects me to the page before the search.
When I search something I have a « Page1 », I have a result « Page2 » and I choose a result « Page3 ».
The link from the « Page3 » redirect me to the « Page1 » and not to the « Page2 ».
My URL from the « Page2 » is like that : « http://localhost/web3/CodeIgniter/scout2gether/totem/search_totem »
That's why it doesn't work.
But I never pass values get from a form to a url, I am sorry.
I am looking on the internet but can you give me some informations about this ?
Thank you for your help.

Samus, I don't really understand the documentation about
Can you give me more explanations please.

Thank you very much you both.

It fine, I save the value that the user enter in a data and when I go back to the search result
I make the request with the value in the userdata.

It works fine, thank you very much

Theme © iAndrew 2016 - Forum software by © MyBB