View Full Version : Values Dissappear After Clicking Back and Forward Button

12-27-2006, 09:56 AM
My problem is like this.

In page 1, i have a text box which promts the user to enter a number between 1-40.

When they click next, in page 2, it will produce dropdown boxes based on the user input (eg: 5 drop down boxes). The records shown in the dropdown boxes are retrieved from a database.

In this page, when a user needs to go back to page 1(previous page), they click the back button and the records are all still there. However, after they've done the changes and clicks next(page 2), the 5 records which I have selected previously are all gone. I have to do them all over again.

What should I do so that the records selected in the dropdown box is still there.?


12-27-2006, 01:07 PM
You can use session variables to store the number of records the user wishes to select at any given time. That way, the variable is accessible from any page and is available until the session is destroyed.

If you have not used sessions before, here is a good tutorial that should give a good ground on how to use Sessions in PHP.


Note: There are loads of tutorials on Sessions. You should do a google search to get more advanced tutorials.

Good Luck.

12-27-2006, 01:29 PM
You could also use cookies to store the data or even $_GET methods