Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zdobson

macrumors 6502
Original poster
Nov 9, 2007
299
0
Indiana
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.
 
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;
 
Here's one way,
Code:
document.order.total.value = (a*b) + (c*d) + (e*f) + (g*h) + (i*j);

Thanks! This is what ended up working for me:

Code:
 document.order.total.value = ((a*b) + (c*d) + (e*f) + (g*h) + (i*j));

note: I didn't try the second version you posted
 
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?
 
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?
 
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?

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

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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.