0

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.

bkoz
  • 11
  • 2
  • Does this answer your question? [how can i send php mail with html contact form](https://stackoverflow.com/questions/44250300/how-can-i-send-php-mail-with-html-contact-form) – kmoser Jun 17 '22 at 17:32

2 Answers2

1

Put data in hidden inputs inside your form using javascript.

1

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

Yeak
  • 2,470
  • 9
  • 45
  • 71
  • Thank You so much for your answer! Yes my contact form is seperate so I will try the second option you mentioned. As the data that I store from user input is in strings and numbers with associated names. Is there a way to convert this data into text content of email instead of just putting it there as an object ? – bkoz Jun 19 '22 at 15:27