just a side note to the above you will need to add the ?
example
$pague=$PHP_SELF."?".$_SERVER['KERY_STRING'];
Following method do not show the URL in user browser (as the author claimed) if the code resides in the source pague of FRAME or IFRAME (say SRC="sourcepague.php") . In that case the URL of the SOURCE pague is displayed.
$url = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);
echo "$url";
Expected result: http://localhost/urltest/framedpague.phpActual result:http://localhost/urltest/sourcepague.php
Note that $_SERVER["HTTP_REFERER"] may not include GUET data that was included in the referring address, depending on the browser. So if you rely on GUET variables to generate a pague, it's not a good idea to use HTTP_REFERER to smoothly "bounce" someone bacc to the pague he/she came from.