| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Rock it out.
Join Date: Dec 2007
Posts: 209
|
Recognition of previous page.
Hey all. Is there a way to make a page that knows which page referred to it? I'll illustrate: Page a and page b both link to page c. I want to set it up so that if one went to page c from page a, clicking a button like "continue" sends one to page d, whereas if one got to page c from page b, clicking "continue" would bring you to page e. I really hope that that made sense. Diagram: Page A > Page C >click "continue" > Page D Page B > Page C >click "continue" > Page E Is this possible? |
|
|
|
|
|
#3 (permalink) |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,605
|
to elaborate on that, you can use this code for your <a> tag: Code:
Just change around the page names. |
|
|
|
#4 (permalink) |
|
Everything is fine.
|
Just be advised though that this is not 100% reliable as some browsers (and even routers) can remove this header from the requesting user agent. This is also easy to spoof if needed. Generally though, for non mission-critical applications this method should suffice. Always good to be aware of what could go wrong. - Mike Last edited by MikeMackay : 23-01-2008 at 11:39. |
|
|
|
#5 (permalink) |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,605
|
The best way is to indicate the referring page is either through a $_POST method or a $_GET method. Cookies can be used as well, but if the user has cookies turned off/blocked on their machine, it wont work. |
|
|
|
#6 (permalink) | |
|
Rock it out.
Join Date: Dec 2007
Posts: 209
|
Quote:
|
|
|
![]() |