| | |
Back button problem with $Sessions and GET
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
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
This is what I do to accomplish the task of disabling the cache..
The head tag at the end of the document is important!
The head tag at the end of the document is important!
PHP Syntax (Toggle Plain Text)
<html> <head> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> </head> <body> Body stuff </body> <HEAD> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> </HEAD> </html>
Real Eyes Realize Real Lies
My Resume
My Resume
![]() |
Similar Threads
- How to disable Back button of IE when executing welcome.aspx page? (ASP.NET)
- Back Button problem (PHP)
- How to disable back button and backspace using Javascript..? (JavaScript / DHTML / AJAX)
- Back button brings "cannot display ... " certain sites (Windows NT / 2000 / XP)
- Get submitted values when navigating back with browser back button (ASP.NET)
- Back button - has login info (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: How do I install Sablotron with PHP?
- Next Thread: CURL PHP Ready function !
| Thread Tools | Search this Thread |
advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla js limit link login loop mail menu mlm multiple mysql oop parse password paypal pdf php problem procedure query radio random recursion regex remote script search server sessions smarty smash sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validator variable video web xml youtube





