Adding Numbers on website

Electronics Computer Programming Q&A
Post Reply
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Adding Numbers on website

Post by Mike »

I know I've asked for help with ASP pages before and nobody was really able to help me, but this time it should be easier, since all I'm trying to do is what a computer was designed for - calculate numbers.<p>I'm working on a website for my computer company where customers can customize a PC and at the end it shows their selections, the cost of each part, and I need to get it to show the total price. I would paste the address here, but I don't want to get blamed for spamming or anything. If anybody would like to look at the page and what I'm talking about, PM me and I'll send you a link. I also don't want to post it because I haven't gone public yet since I'm not done with the site.<p>Anyway, it took a lot of work and database writing to get it to work as it is, but I just can't figure out how to get it to add the numbers together.<p>On the final page, it looks in the database for the current price of each part, and then puts the description and price of the part on the screen, and at the bottom I want a section labeled Total, where the prices are all added up and the user sees the price.<p>For example, to make it easy, say the processor is $100, the motherboard is $100, the hard drive is $50, the memory is $50, the operating system is $150 and the optical drive is $50. I need it to total that up and add $100 for labor and display $600 as the total.<p>Can this be done with ASP? If so, does anybody know how I would be able to do it?<p>Thanks,
Mike
positronicle
Posts: 233
Joined: Wed Jul 13, 2005 1:01 am
Contact:

Re: Adding Numbers on website

Post by positronicle »

--Edited by Positronicle--
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Re: Adding Numbers on website

Post by Mike »

It looks like it would work, but I just can't figure out how to do it.<p>Do you understand ASP pages? If so, would you mind looking at the code and telling me how I could impliment that code into my page? I can send you the link and the source code via email.<p>And if you are interested in helping me I will of course offer you a good deal on a computer if you ever need one.<p>Thank you,
Mike
Jeep4by4
Posts: 12
Joined: Tue Jun 28, 2005 1:01 am
Contact:

Re: Adding Numbers on website

Post by Jeep4by4 »

I've never done any ASP programming, but it seems similar to other web programming that I've done, so I'll try to interpret the example a little for you...<p>First you need to make a function that adds up what you want to...
<%
Function add(intA, intB, etc...)
Dim intResult <-- declares the variable
intResult = intA + intB + ... <-- add up what you want to<p> add = intResult <-- set the result to the function name so it returns properly
%><p>Then in the body of your page, put the following code where you want the sum to go:
<%= add(intA, intB, etc...) %>
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Re: Adding Numbers on website

Post by Mike »

Thanks, I'll try that. Hopefully it will work.<p>
Thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 16 guests