As often posted, referers aren't too reliable (I for one turned "Send Referrer" off in my browser).
Another solution (not too reliable neither) could be to add a hidden field in the form with the URL, or script name. Or analyze your webbrowser's access log (may be overkill, but probably works best).