Creating Web Order Form

Discussion in 'Web Design and Development' started by zdobson, Apr 3, 2008.

  1. zdobson macrumors 6502

    Joined:
    Nov 9, 2007
    Location:
    Indiana
    #1
    I want to create a print ordering system for my website. This is the general format I want it to be in:
    http://www.zachdobson.com/order_form4c.htm

    Here is the code that I found that works for getting the subtotals, but I'm having a hard time figuring out how to add up the subtotals to reach the grand total.

    Code:
    <!--
    function displayprice()
    {
    var a = document.order.product.value;
    var b = document.order.qty.value;
    var c = document.order.productb.value;
    var d = document.order.qtyb.value;
    var e = document.order.productc.value;
    var f = document.order.qtyc.value;
    var g = document.order.productd.value;
    var h = document.order.qtyd.value;
    var i = document.order.producte.value;
    var j = document.order.qtye.value;
    
    document.order.totalprice.value = a*b
    document.order.totalpriceb.value = c*d
    document.order.totalpricec.value = e*f
    document.order.totalpriced.value = g*h
    document.order.totalpricee.value = i*j
    
    }
    Thanks in advance.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Here's one way,
    Code:
    document.order.total.value = (a*b) + (c*d) + (e*f) + (g*h) + (i*j);
    Here's another,
    Code:
    document.order.total.value = document.order.totalprice.value
      + document.order.totalpriceb.value
      + document.order.totalpricec.value
      + document.order.totalpriced.value
      + document.order.totalpricee.value;
     
  3. zdobson thread starter macrumors 6502

    Joined:
    Nov 9, 2007
    Location:
    Indiana
    #3
     
  4. zdobson thread starter macrumors 6502

    Joined:
    Nov 9, 2007
    Location:
    Indiana
    #4
    Ok, now I'm not sure how to email this form to myself. I have a "contact me" form on another page, but I can't use the same method with this form. Here is the java script

    Code:
    <!--
    function displayprice()
    {
    var a = document.order.product.value;
    var b = document.order.qty.value;
    var c = document.order.productb.value;
    var d = document.order.qtyb.value;
    var e = document.order.productc.value;
    var f = document.order.qtyc.value;
    var g = document.order.productd.value;
    var h = document.order.qtyd.value;
    var i = document.order.producte.value;
    var j = document.order.qtye.value;
    var k = document.order.shipping.value;
    var l = document.order.zero.value;
    
    document.order.totalprice.value = a*b
    document.order.totalpriceb.value = c*d
    document.order.totalpricec.value = e*f
    document.order.totalpriced.value = g*h
    document.order.totalpricee.value = i*j
    document.order.total.value = ((a*b) + (c*d) + (e*f) + (g*h) + (i*j) + (k*1) + l);
    }
    
    Any ideas?
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Not really sure what your contact page is using form email, just that it goes to some Yahoo thing. On my site I have some PHP I wrote that uses the PHP Pear Mail functions to send emails to myself. What language do you want to write this in?
     
  6. zdobson thread starter macrumors 6502

    Joined:
    Nov 9, 2007
    Location:
    Indiana
    #6
    Whatever language works. I only know what I'm able to extrapolate from other people's codes. The form I'm using is already in Java, so I don't know if everything has to be the same or not. As you saw, the contact form I made using Yahoo. I'll use whatever will work in conjunction with the code I already have.
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    Think you mean JavaScript instead of Java. There's a big difference. Anyways, I'd suggest doing some searches. This is a common thing for people to want, and thus a number of sites have scripts ready to download and use. There should be plenty of good free ones as well so don't waste money paying for any. Also make sure to find out what languages for web server is setup for. Most of the scripts out there will use PHP, but some may use Perl, or other CGI-based languages, which some servers may not be setup for.
     
  8. Darran macrumors member

    Joined:
    Mar 31, 2008
    Location:
    Singapore
    #8
    It can be done in many ways. You don't need everything to be the same, the way I see it, JavaScript is more of browser scripting. You should be aiming at server scripting, languages like PHP, ASP or JSP should serve you well. Since PHP is free and one of the most widely used, you can use the mail() function.

    http://devzone.zend.com/manual/ref.mail.html

    Of course when you submit your values, don't forget to retrieve them as well. The $POST['fieldname'] and assign it to a variable should get you started.
     
  9. Les Kern macrumors 68040

    Les Kern

    Joined:
    Apr 26, 2002
    Location:
    Alabama
    #9

Share This Page