Forum Moderators: coopster

Message Too Old, No Replies

how do I get the calling pages script name

         

1rhyno

2:46 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



I was wondering if there were any functions like $_SERVER['SCRIPT_NAME'] but instead of the current name I get the calling pages script name.

RonPK

4:12 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$_SERVER['SCRIPT_NAME']
$_SERVER['REQUEST_URI']
$_SERVER['PHP_SELF']
__FILE__

Have your pick :)

Or do you mean $_SERVER['HTTP_REFERER'] ?

1rhyno

4:44 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



I may not have explained my situation correctly...
I know that $_SERVER['SCRIPT_NAME'] will hold the name of the current page. I was just wondering if there were any other $_SERVER variables that would have the calling page.

I have two files... a header.php and a appointments_done.php the header file is called at the beginning of every page, but if the calling page is appointments_done.php I want a different version of header.php to display.

I was planning on doing a simple name check in my if statement. Like,
if ($_SERVER['HTTP_REFERER'] =='/staging/appointments_done.php'){
...}
If this does not work.... I am unsure why.

RonPK

7:22 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand you correctly, then you probably want this in header.php:

if ($_SERVER['PHP_SELF'] =='/staging/appointments_done.php') { 
// do things
} else {
// do something else
}

1rhyno

9:57 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



Thank you RonPK that solve my problem.