How do I identify where the POST data sent to a PHP script came from?
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 hidd开发者_开发问答en field in every form with its URL?
Send the following variable in the email as well:
$_SERVER['HTTP_REFERER']
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.
精彩评论