/    Sign up×
Community /Pin to ProfileBookmark

This has really been bugging me. I can’t figure out a php function that returns the path of the page that the script executed on (so if that url was turned into a link, it would just come back to the same page you clicked the link from)

Is there one? And if so, what is it called (a few examples would be helpful). I need this script because I run a mostly html site, but lately I’ve been adding php files for more functionality (I really don’t know php, so I’ve been using free downloads off the web). I got a really simple guestbook program and I’ve edited to my needs, I just need to be able be notified by email when someone posts. I found the email function, but then realized that within the email I’d have to have some way to identify which guestbook was edited, so I figured that if the code automatically generated the url of the page that the script executed on, I could easily determine what folder it was in. You see, I have the need for about 25+ guestbooks within my web, and it gets kinda hard to track them all. And because I need 25 of them, I need to be able to easily duplicate them with minimal page changes, so if I need to always find the php code that tells the email what to say and edit that to also note what guestbook it is, or add a hidden field and edit it for each guestbook, it would greatly compound the time I spend on this. Thank you!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriAug 28.2004 — do you mean this

in php code use

echo "<a href="".$PHP_SELF."">LINK</a>";

or out of php tags use

<a href="<?php echo $PHP_SELF; ?>">Link</a>
Copy linkTweet thisAlerts:
@EupseudesauthorAug 28.2004 — Not exactly, but I think you gave me the answer.

is $PHP_SELF a special variable that is the url?
Copy linkTweet thisAlerts:
@96turnerriAug 28.2004 — well yes and no

if i was on a page

http://www.google.com/path/to/something/foo.php

$PHP_SELF would to /path/to/something/foo.php

if i was on

http://www.google.com/page.php?q=foo

$PHP_SELF would be

/page.pgp?q=foo

[URL=http://uk2.php.net/reserved.variables]Official Documentation On $PHP_SELF[/URL]
Copy linkTweet thisAlerts:
@EupseudesauthorAug 28.2004 — I see... nevertheless, that is good enough for me, since I don't have 50 domains! Thanks for your help!
Copy linkTweet thisAlerts:
@96turnerriAug 28.2004 — your welcome,

the official documentation link has others init

Rich

most are $_SERVER[XX]

XX you can get referer, ip, current page etc
×

Success!

Help @Eupseudes 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.18,
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,
)...