In one of my page image.php?id=somenumber , I am using <?php echo $_SERVER['PHP_SELF']; ?> to recognize this page in the common sidebar. But using this $_SERVER['PHP_SELF'] yields also the value of id as image.php?id=32 which I don’t want.
How do I only get the filename?
$_SERVER['SCRIPT_NAME'], if you are using Apache at least, should cover what you need. It should be the executed script without the query string and relative to the document root (as opposed toSCRIPT_FILENAME,REQUEST_URI, orPHP_SELF.