Get everything after the domain name folders, query strings etc http://stackoverflow.com/questions/20127113/php-serverphp-self-to-include-query-string
<?php
// if user is on page http://www.domain.com/mypage.php?query_ecr='10004'
$_SERVER['PHP_SELF'];
// will yield
// http://www.domain.com/mypage.php
$_SERVER['REQUEST_URI'];
// will yield
// http://www.domain.com/mypage.php?query_ecr='10004'
?>
<?php
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// http://stackoverflow.com/questions/6768793/get-the-full-url-in-php
?>