Jump to content

going back to search results


gerkintrigg

Recommended Posts

Hiya.

 

I'm trying to work out how to go back to the search results page from an individual product page. I've tried to use the following code:

 

if (isset($HTTP_REFERER)) {
echo "<a href='$HTTP_REFERER' class='text'>Back to search results</a>";
} else {
echo "<a href='javascript:history.back()' class='text'>Back to search results</a>";
}

 

but the problem is that it just sends the user back to the last page, so isn't reliable enough.

 

I have a product page which contains one or more images, each image requires the page to re-load, so I want to re-direct the user to the search page from any of these iterations.

 

Could someone suggest how to do this? Is there a way of writing search variables into a session identifier that I can easily reference?

 

I know of several ways to do it using if statements and writing lots more sessions but I'm sure there's a cleaner way...

Link to comment
https://forums.phpfreaks.com/topic/51312-going-back-to-search-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.