Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Values Dissappear After Clicking Back and Forward Button

    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.?

    thanks

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    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.

    http://www.htmlgoodies.com/beyond/ph...le.php/3472581

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

    Good Luck.
    Ess

  • #3
    Regular Coder
    Join Date
    Oct 2005
    Location
    Surrey, England
    Posts
    286
    Thanks
    2
    Thanked 2 Times in 2 Posts
    You could also use cookies to store the data or even $_GET methods
    Daniel Warner
    - - - - - - - - - -
    GuitarMart.co.uk - Free Online Classified Advertisement for Guitarists in the United Kingdom. Free Ads with a Free Photo.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •