note 40710 added to ref.url

From: Date: Thu, 11 Mar 2004 21:38:54 +0000
Subject: note 40710 added to ref.url
Groups: php.notes 
Request: Send a blank email to php-notes+get-66687@lists.php.net to get a copy of this message
I have been toying a bit with retrieving the (relative) path of the URL of the page you're working on right now. I experienced some nice problems with pre-defined variables, in combination with the different settings of different servers. My goal was to retrieve both "index.php" as a link, and "index.php?var1=123&var2=456" ... I found this to work pretty OK: error_reporting(0); // No error reporting // Try to retrieve the required values $PageLink=$_SERVER['PHP_SELF']; $PageParams=$_SERVER['QUERY_STRING']; error_reporting(E_ALL); // Error reporting on if ($PageParams) { echo $PageLink.'?'.$PageParams; } else { echo $PageLink; } Figured it might be useful for other users ... ---- Manual Page -- http://www.php.net/manual/en/ref.url.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40710 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40710&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40710&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66687) next »