Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.