943,540 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 9163
  • PHP RSS
Jul 15th, 2004
0

Back button problem with $Sessions and GET

Expand Post »
If your familiar with database search results, then you probably know how useful the GET method is. My results page is a list of site members from the database. We want to have a feature that allows users to add these members to a html select box to "save a list of favorites". Every time a user clicks the Add button, the page redirects to itself and we are using session variables to save the list.

Here's the problem with the Browser Back button

1.) Lets say your on page one and you add two members to the list. The GET url will have &list=1,2 appended to the end where 1 and 2 are the two members. The session looks at the variable called "list" and makes an array from the list
2) The user goes to page two of the search results. They add another member. Because the page redirects to itself right after adding to save the added member, the new GET url is &list=1,2,3 The session is resaved with this list
3) The user clicks "BACK". Browsers dont rebuild a dynamic page when you click back so the member that got added in the second page is not present.

How do I solve the back problem?

-Brad
Similar Threads
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
bwest is offline Offline
57 posts
since Jul 2004
Sep 12th, 2009
0

Re: Back button problem with $Sessions and GET

This is what I do to accomplish the task of disabling the cache..
The head tag at the end of the document is important!
PHP Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  4. <META HTTP-EQUIV="Expires" CONTENT="-1">
  5. </head>
  6. <body>
  7. Body stuff
  8. </body>
  9. <HEAD>
  10. <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  11. <META HTTP-EQUIV="Expires" CONTENT="-1">
  12. </HEAD>
  13. </html>
Team Colleague
Reputation Points: 55
Solved Threads: 3
Junior Poster
meabed is offline Offline
139 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How do I install Sablotron with PHP?
Next Thread in PHP Forum Timeline: Find String in PHP Ready easy function





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC