[thelist] getting page name with PHP

Simon Willison simon at incutio.com
Tue Sep 10 14:56:01 CDT 2002


At 12:33 10/09/2002 -0700, Tom Dell'Aringa wrote:
>function highlightThing()
>{
>   var page = somehow get php page name here;
>   myItem = getElementById(page);
>   highlight that item
>}
>
>How do I get that in PHP?

Variables like that are contained in the $_SERVER and $_ENV suprt-global
arrays. Here's a handy trick for finding out what they are:

<pre><?php
print_r($_SERVER);
print_r($_ENV);
?></pre>

Run the above code on your web server and you will see the contents of the
above arrays, making it easy to pick out the variable you need.

Cheers,

Simon Willison

--
Web Developer, www.incutio.com
Weblog: http://simon.incutio.com/




More information about the thelist mailing list