Reputation: 1216
I have several forms on my website, which use one action.php file to send users inputs to my email. I want to name each form by giving them IDs and have the name printed in my inbox once I receive the inputs. Is it possible to do so with PHP?
HTML
<form id="form1">
</form>
<form id="form2">
</form>
PHP
$form_name = "?????"
$email_body = "Form Name: $form_name.\n".
"First Name: $first_name.\n".
"Last Name: $last_name.\n".
"Email Address: $visitor_email.\n".
"Price Package Selected: $price.\n".
"Message:\n $message \n".
Upvotes: 3
Views: 65
Reputation: 292
Yes you should be able to get the values submitted with the form. Add a hidden input field to the form and name it: form_name and set the value to the name of the form. Then you can get the value as you do with your other form field values. So shouldn't be hard to figure out.
Upvotes: 2