View Full Version : show the value of (.innerHTML) on the email

08-06-2012, 07:43 PM
hey people, i have a order form, in which the submitted data goes to an email address. The order form has various sections. Within each section there are various products with its price. When customers select the products within a section, there is a total button within each section which shows the subtotal. The resulting subtotal is shown in (.innerHTML)


document.getElementById("resultChicken").innerHTML = resultChicken.toFixed(2);

(i know the code above is javascript, however the main problem is php related)

there is also a grandtotal button to show the grandtotal in (.innerHTML)

is there any way of sending the subtotals and grandtotal to email address with the filled in data?

would really appreciate it if someone could help

thank you

08-07-2012, 04:38 AM
$email_body = "<div id='resultChicken'>{$chickenSubtotal}</div>"

08-08-2012, 10:10 AM
thanx kbduvall, however i will be having SEVERAL of these subtotals (.innerHTML), and when the customer clicks on one or more of those several buttons, it should show the subtotals on the email. is there any way of doing this?

i managed to do that for the form fields as u can see below:

$message = "

<head><title>Order placed</title></head>
<p>Email is from ".$email."</p>

$trimmed = array_map('trim', $_POST);
$cleaned = array_map('htmlentities', $trimmed);

$exclude = array("field_name1", "fieldname2"); // the fields you don't need to check

foreach ($cleaned as $key => $value) {
if (!in_array($key, $exclude) && !empty($value)) {
$message .= ucwords(str_replace("_", " ", $key)) . ": $value</br>";

When a customer fills in the form and select the relevant products, it shows up only the products that are selected or if the fields are filled in

i wanted a similar thing for the subtotals too where if the customer clicks on a particular subtotal button and clicks submit, then only the subtotal to which the customer clicked on, will show up on the email

thank you