/    Sign up×
Community /Pin to ProfileBookmark

How To get URL of the current page

hello friends,

I am having some values on one page. and i want to pass the value to another page.

I want to get the url of the page on which i am right now.

So how can i get the url of the currentpage.

Jaydeep..

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@WebnerdMay 12.2006 — $url="http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"];
Copy linkTweet thisAlerts:
@porkyMay 12.2006 — try this

$www_location = 'http://' . getenv('HTTP_HOST') . getenv('SCRIPT_NAME');
Copy linkTweet thisAlerts:
@WebnerdMay 12.2006 — $_SERVER variables are globally set. getenv() is a function and requires overhead, why run a function to get values that are already set?
Copy linkTweet thisAlerts:
@porkyMay 12.2006 — you are right Webnerd

but there are no _SERVER array in the old PHP versions
Copy linkTweet thisAlerts:
@WebnerdMay 12.2006 — If you are running anything older than 4.1.0, use $HTTP_SERVER_VARS
×

Success!

Help @Jaydeep 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.20,
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,
)...