I’m trying to build an online ordering form for a restaurant. There are different types of food items that require different input fields. I’m using jQuery to add these input fields after the user clicks a link to add a certain product. I’m basically appending these form fields to a div so the user can fill them out.
After the user is done adding items and click the submit button I want to use PHP to send the order to an email address. I know how to send email in PHP, but I’m not sure how to get all of the form data into the email.
I won’t know how many fields the user adds until they hit the submit button. My question is, once the user hits submit what can I do to get all of the form fields and spit it out into a body string for the email? Can I use an array to store all of the form data and go through the array in PHP and get all of the data out of it?
Thanks for your time!
All of the form data that is submitted will be in the
$_POSTarray … Loop through that and get what you need …For Instance (Assuming you know the names of the fields you are getting data from):