Need help with order form not emailing total

Discussion in 'JavaScript' started by redfive, May 25, 2012.

  1. #1
    I have an order form that calculates the total, but the total is saved in a <div> and not in the form so when I hit submit, I get everything emailed except the total. Any ideas on how I fix this?

    Here is the link: http://www.redfivedesigns.com/mapp/estimate.html

    Thanks,

    Tommy
     
    redfive, May 25, 2012 IP
  2. HostPlanz

    HostPlanz Well-Known Member

    Messages:
    449
    Likes Received:
    34
    Best Answers:
    4
    Trophy Points:
    130
    #2
    divs don't have a value attribute, so they cannot be used to POST data

    Insert this in your form's HTML
    <input type="hidden" name="total" id="total" value=""/>
    Code (markup):
    Use JavaScript to change the value of the <input> above.
    
    [COLOR=#000000][FONT=verdana]//If total is 200 for example
    
    var total = document.getElementById('total');    [/FONT][/COLOR]
    [COLOR=#000000][FONT=verdana]total.value = "200";[/FONT][/COLOR]
    Code (markup):
     
    HostPlanz, May 25, 2012 IP
  3. redfive

    redfive Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So does this look right if I want the total displayed and emailed?

    <div id="totalPrice"></div>
                    <input type="hidden" name="totalPrice" id="totalPrice" value=""/>
                    </fieldset>
    Code (markup):
     
    redfive, May 25, 2012 IP
  4. HostPlanz

    HostPlanz Well-Known Member

    Messages:
    449
    Likes Received:
    34
    Best Answers:
    4
    Trophy Points:
    130
    #4
    Yes, it can work that way.
     
    HostPlanz, May 25, 2012 IP
  5. HostPlanz

    HostPlanz Well-Known Member

    Messages:
    449
    Likes Received:
    34
    Best Answers:
    4
    Trophy Points:
    130
    #5
    what cannot?
     
    HostPlanz, May 28, 2012 IP