PHP contact form: can I take the value of a span instead of an input?
-
01-10-2019 - |
Question
I'm setting up a contact form, but I have some saved information in some spans (It's an ecommerce shopping basket) and the built in checkout is awful so we're just slapping together an easy solution: turn it into an email form and email us the order instead of losing customers.
Anyway, can I use the info in the span, taking the id
or name
or do I have to turn it into an input? And if I do, how can I disable the input field?
Example of code I want to take into the email is in this jsFiddle, I want the spans with name="ACTUAL PRICE" etc emailed. Is this possible?
Thanks :)
Solution
Maybe you want to use a hidden input field.
<input type="hidden" name="key" value="foobar" />
It is not displayed, but can be used to submit information with the form.
OTHER TIPS
You'd be far better off using hidden form fields if possible. Else if the user has JS disabled you may run in to issues down the line. Rare but possible.