I created an website that calculates an amount of money that can be returned. Now I need to create a contact me form that will send not only users name and email in that ws put in the form, but that email also needs to contain the values that where put in the calculator inputs, by the user (currently I am holding that data in an obj). From what I read there is a way to use PHP to send emails from contact me form. But as I am new to WebDev I do not know of any way to convert data put in the calculator forms by the user (that I store in js object for lack of better way that is known to me) to text in email that can be sent back to my mailbox each time user clicks "contact me" button. Does anybody has any guidelines where I can look to find some tips for how to crack it? This is the last functionality that I need to add and as of now I am completely lost...
Any feedback is very much appreciated.
CodePudding user response:
Put data in hidden inputs inside your form using javascript.
CodePudding user response:
So with lack of any sample code or what you tried ill try to answer as best as i can.
Option one would be to put the entire calculator form and the contact part into a single element where on the submit it will contain all the form data and you can use php $_POST to retrieve all the input values and send out the email.
If the data is in a javascript object and your form for contact is seperate you can take the data from javascript and insert that data into a Hidden input element and use javascript to insert the data as the value for that element by ID or name. Then when you submit the contact form you will have that hidden element show up in the $_POST