Reputation: 1170
I have a ton of data collection forms on my website, and I wrote a PHP script to handle all the data. All the forms have that one script as their action, and POST as the method. The handler emails a copy of the data to me, and I'd like for the emails I get to contain the URL of the form where they originated. Is there any way in PHP to get the url of the form which was submitted to the script? Or do I have to add an extra hidden field in every form with its URL?
Upvotes: 0
Views: 582
Reputation: 250822
If you want to ensure that posts only arrive from your own form, you could put a one-time token on the form in a hidden field to validate.
Upvotes: 2
Reputation: 23244
Send the following variable in the email as well:
$_SERVER['HTTP_REFERER']
Upvotes: 3