A suggestion would be to track the $HTTP_REFERER the first time, and then set it in a cookie (see setcookie(). After the user has navigated to the area in which you need to grab the referer (the page with the form), grab the data from the cookie, and insert into a hidden form field which will be submitted with the rest of the form.
Of course, if the user has cookies turned off, this will not work. An alternate solution would be to use sessions.