One piece of information that you might like to pass along with the information that your visitors enter into a form on your site (particularly if you have lots of pages that link to the form page) is which page that they were on before they came to the form. One example of where this would be particularly useful if the form were there to allow people to report errors found in the content of your site.
Let's start by adding a field to our form. All we need to do is to define a new hidden field and give it an id (I'll use 'referrer').
<input type="hidden" name="prevpage" value="" id="referrer"/>
document.getElementById('referrer').value = document.referrer;
This article written by Stephen Chapman, Felgall Pty Ltd.