I'm trying to use the page URL as a variable inside a form submission so that I can write it into my database and figure out what pages are getting more list sign-ups. Is there any easy way to do this?
<input type="hidden" name="page_url" id="page_url"/>
<script type="text/javascript">
document.getElementById("page_url").value = location.href;
</script>
Put the value of $_SERVER["REQUEST_URI"] inside a hidden input in the origin form, so you can check for it on the form processing script.
Ideally, if every form links to the same parsing page, you have two options
Option 1: Created a hidden form variable on EVERY form page that records the URL of the page via static input, or from Javascript or PHP, both of which are detailed in the earlier answers.
Option 2: On the parsing page, use $url = $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"] to get the page that directed to your parsing page, and record that in the database.
I would probably go with Option 2, as it is a bit more elegant and easier to modify, and can even let you know if a user attempted to inject the form with a copy they stored locally on their hard drive.