/    Sign up×
Community /Pin to ProfileBookmark

knowing from what page I came from

Hello people

I have 3 pages in the application
both page A.html and page B.html have a link to page C.php
When I get to page C.php I need to know from what page I came from.

I know that I can pass it as a parameter in the URL, but I was wondering if there is a more basic construct in PHP that will allow me to know this without having to perform an explicit action

regards

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@k0r54Jan 11.2005 — what i do is either 1 off two things,

I either use the _get method just just put it in url

blah.com/?ref=a

Or i pass a veriable on that says wat name the page is.


The third way can only be used depending how you are linking to page c.

If it is through header you cannot use this, but if it is through a normal href link then you can use

[code=php]
$_SERVER['HTTP_REFERER']
[/code]


Hope this helps
Copy linkTweet thisAlerts:
@jasongrauthorJan 11.2005 — I understand that the $_SERVER['HTTP_REFERER'] method isn't very reliable and it depends on the browser implementation.

I think I will take care of this explicitly when I build the link the page C.php and then it will be available via $_REQUEST
×

Success!

Help @jasongr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...