Kyle
Kyle

Reputation: 67204

PHP contact form: can I take the value of a span instead of an input?

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 :)

Upvotes: 0

Views: 293

Answers (2)

Ross
Ross

Reputation: 17987

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.

Upvotes: 3

Sjoerd
Sjoerd

Reputation: 75629

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.

Upvotes: 6

Related Questions