A useful function to get and display the current page url.

<?php
function getPageURL() {
$pURL = ‘http’;
if ($_SERVER["HTTPS"] == “on”) {$pURL .= “s”;}
$pageURL .= “://”;
if ($_SERVER["SERVER_PORT"] != “80″) {
$pURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pURL;
}

echo getPageURL();

?>