Вот решение, которое я реализовал.
На любой HTML-странице с опцией контакта вызовите простой скрипт, как указано ниже.Если JS недоступен, контактная форма открывается через 'href' и, конечно, без исходного URL.
<a href="/contact/contact-form.php" title="send an eMail" onclick="return(contact())">Contact the author</a>
..., который помещает строку текущего URL в 'strReferrer' и открывает новыйокно с вашим contact-form.php
<script>
var strReferrer = location.href;
function contact() {
window.open("/contact/contact-form.php?sourceURL="+strReferrer);
return false;}
</script>
PHP запрашивает строку с помощью 'strReferrer' и сохраняет ее в '$ params'.в contact-form.php:
//get the URL from the originating page (where this form has been called from)
$params = $_SERVER['QUERY_STRING'];
...
...
// Insert '$params' into the text as part of the text to be eMailed.
// the eMail Content Header for the recipient
$_POST["text"] = $_POST["send"]["author"]." with e-mail address: ".$_POST["send"]["mail"]." sent the msg below: \n <$params> \n \n $texto";
Теперь вы знаете URL-адрес страницы, по которому ваши посетители решили связаться с вами.