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
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...  ???

Link to comment
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...  ???

 

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...

Link to comment
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...  ???

 

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

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.