/    Sign up×
Community /Pin to ProfileBookmark

Output current page.

Hello there,

i’m looking of a way storing the page the user is currently visiting in a variable or anything that can be done to output it.

I have a form and i want it to do action based on the page the user is currenly visiting.

Thanks in advance!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiDec 09.2008 — Try:

[code=php]
$script = $_SERVER['PHP_SELF'];
[/code]
Copy linkTweet thisAlerts:
@Lo0kBeHiNdUauthorDec 09.2008 — Thanks but i found it out.

[code=php]function curPageURL() {
$pageURL = 'http';
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}[/code]
Copy linkTweet thisAlerts:
@TecBratDec 09.2008 — Try:

[code=php]
$script = $_SERVER['PHP_SELF'];
[/code]
[/QUOTE]


you might make that [code=php]$script = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];[/code]
if you have dynamic content.
×

Success!

Help @Lo0kBeHiNdU 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.13,
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,
)...