How to memorise page history and use it later

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BaltarPHP
Forum Newbie
Posts: 10
Joined: Sun May 03, 2009 7:35 am

How to memorise page history and use it later

Post by BaltarPHP »

Hello. Im new at php. Im have to take over a webpage project written in PHP by other person so im still studing the code (so hard to read other persons code). The webpage has a search engine of products. After searching there is a list of found products. Now if i click on the product i can see it and there are two buttons to browse trough the found products - "next product" and "previous product". I would allso like to add a button called "back" and when i click on it, it would go back to the search result page.

So how can i programm the php to memorise the search result page and use it as shortcut later. I allready managed to add the "back" button. Right now when i click on it, ofcourse nothing happens. Please help.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: How to memorise page history and use it later

Post by McInfo »

Use session variables to save the arguments that are posted when the client uses the search form to access the results page. When the client returns to the results page using the back link, use $_SESSION instead of $_POST to build the query for the database.

You could use sessions to cache the entire result set, but that's probably not the best solution if there is a lot of data to be cached.

PHP Manual: Session Handling

Edit: This post was recovered from search engine cache.
Post Reply