Jump to content

Calculation won't send in email.


djmcr

Recommended Posts

I have a javascript code that calculates the total price from a form.

 

The data from the form is then emaild to me.

 

All the data comes through except the total.

 

Here is the line which displays the total.

"

<fieldset>

<b>Total: $ <div id="calculation" name="total" style="display:inline;">0</div><br /></b>

</fieldset>

"

Here is the line in my php.

"

Total Price: ".$total."

"

I have tried using the id tag in php as well as the name tag, I don't know where to go from here.

 

The order page can be found at "www.djmcr.com.au/ade/order.html"

 

 

Please help I have been banging my head against a wall for a three weeks about this.

Link to comment
https://forums.phpfreaks.com/topic/77247-calculation-wont-send-in-email/
Share on other sites

div is not part of the form so what ever you do you cant submit the value inside the div

 

like the other member said place your value in a hidden field

 

<input type="hidden" name="textfield" value ="your value"/>

 

But doesn't the page reload? I only just thought of that so writing it in php wouldn't be any good either^^ like every time the price is calculated the page will reload...  ???

div is not part of the form so what ever you do you cant submit the value inside the div

 

like the other member said place your value in a hidden field

 

<input type="hidden" name="textfield" value ="your value"/>

 

But doesn't the page reload? I only just thought of that so writing it in php wouldn't be any good either^^ like every time the price is calculated the page will reload...  ???

 

the thread starter said he has a JS that calculates etc...

so no need to reload JS will give the desired value on the hidden field

 

eg... onclick assign the value on the hidden field

im some reason maybe reloading the page looks odd.

if you have say... ten calcualtion to process would you want your page to reload ten times?

cheers...

div is not part of the form so what ever you do you cant submit the value inside the div

 

like the other member said place your value in a hidden field

 

<input type="hidden" name="textfield" value ="your value"/>

 

But doesn't the page reload? I only just thought of that so writing it in php wouldn't be any good either^^ like every time the price is calculated the page will reload...  ???

 

if you have say... ten calcualtion to process would you want your page to reload ten times?

cheers...

 

errr probably not^^ I just got the wrong idea..

 

cheers...  :P

Thanks for the help so far.

 

I have not been able to work out how to make the result of my javascript calculation be the value of the hidden field.

 

The total amount is calculated correctly and displayed on screen but still won't send as part of the form email.

 

The javascript is as follows.

 

 

<script type="text/javascript">

 

function recalculate()

{

    var value = 0;

    if(document.getElementsByName('adepoem')[0].checked) {value += 20;}

 

    if(document.getElementsByName('a4')[0].checked)

    {

        value+=document.getElementsByName('a4q')[0].value*20;

    }

 

    if(document.getElementsByName('cards')[0].checked) {value += 20;}

 

    document.getElementById('calculation').innerHTML=value;

};

</script>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.