Returning to a Previous Page
| From: | Nelson Goforth | Date: | Sun, 09 Feb 2003 22:19:08 +0000 |
| Subject: | Returning to a Previous Page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134987@lists.php.net to get a copy of this message | ||
In my application I'd like the user to be able to return to a page that they have had to leave in order to register or log-in to the application. (It's a sort of shopping cart)
The URL contains a couple of items of data in the query string.
I figure there are two options (and let me know about others) - 1. pass the URL back in hidden fields, and 2. every time the user visits a 'product' page, set that page in a session variable - then when they are done registering I collect the URL and return to that page (so that they don't have to start their search all over again).
Is there an advantage to either solution. What problems would I have in resetting the session variable for each page visited?
==
Additional question on the same topic: No single ENV variable that I can find gives me the full URL. And "REQUEST_URI" gives me too much for use.
i.e.: Let's say the URL is http://www.mydomain.com/about/this/thatfile.php?key=42&name=zaphod
It seems that to return to this page I need either the full URL or just "thatfile.php?key=...etc", but REQUEST_URI gives me "/about/this/thatfile?key=....etc"
So, I can concatenate HOST and URI variables to get what I want, but am I missing something here?
I am running sessions in this application.
Thank you for any assistance,
Nelson
========================================================
Nelson Goforth http://www.goforthstudio.com Computer Database Programming: Perl, PHP, SQL, VBA