The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML Calculation, performing basic arithmetic in HTML
TimT
post Oct 10 2011, 12:11 PM
Post #1





Group: Members
Posts: 4
Joined: 9-October 11
Member No.: 15,590



I have a form base that I am collecting data from clients.

I want them to input values for Field 1, Field 2, Field 3, and Field 4.

I then want my form at Subtotal 1 to calculate Field 1 + Field 3 and Subtotal 2 to calculate Field 2 + Field 4

I then want my form at Total 1 to calculate Subtotal 1 + Subtotal 2.

I then have a field that will use the data from Field 1 and from another input bdrm1 and it will calculate "if-and/or-else" and return a value.
bdrm1 is bedrooms so as an Electrician I am building my own bidding software. If you select 3 bedrooms then that will take us to a different table than if you entered 2. Then the other data would be Number of Receptacles and Switches.

So, 3 bedroom house Field1 = 4 and Field3 = 2, it will calculate a value...so I will have to establish a table (data base) to calculate the factors and put them in cells for quicker reference and pulling.

Tim
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 10 2011, 01:16 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



For the record, you can't perform basic arithmetic in HTML. HTML isn't a programming language; it's just markup.

Since you posted to the client-side scripting forum, I'm assuming that you want to do these things in JavaScript.

Are you familiar with JavaScript? Can you post the URL (address) of a page that shows your best attempt?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 10 2011, 02:24 PM
Post #3


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE
I have a form base that I am collecting data from clients.


So you must be writing a server script to collect this data, and store it in a database... right? (If you are hoping to "collect data" in html, well, it isn't going to happen.)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
TimT
post Oct 10 2011, 07:24 PM
Post #4





Group: Members
Posts: 4
Joined: 9-October 11
Member No.: 15,590



QUOTE(Darin McGrew @ Oct 10 2011, 01:16 PM) *

For the record, you can't perform basic arithmetic in HTML. HTML isn't a programming language; it's just markup.

Since you posted to the client-side scripting forum, I'm assuming that you want to do these things in JavaScript.

Are you familiar with JavaScript? Can you post the URL (address) of a page that shows your best attempt?


For this nonprofit organization I am starting the url is www.moncpa.us then to Missouri Forms and Form 14.

I want it to fill in. Very basic Javascript, PHP and MySQL, C++, and ASP.NET in C#...I just noticed when I first started doing pages for my own
electrical company, I purchased Frontpage and it utilizes HTML as the base and with that I can put it into the code side of Frontpage and it will
make it happen for the most part.

On this one I wrote everything out, but have lost the pdf printing function and thought I would step it up so that it calculates the data for the client.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
TimT
post Oct 10 2011, 07:39 PM
Post #5





Group: Members
Posts: 4
Joined: 9-October 11
Member No.: 15,590



QUOTE(Brian Chandler @ Oct 10 2011, 02:24 PM) *

QUOTE
I have a form base that I am collecting data from clients.


So you must be writing a server script to collect this data, and store it in a database... right? (If you are hoping to "collect data" in html, well, it isn't going to happen.)


No the database application I will be using will be MySQL, I just haven't gotten comfortable enough yet to tackle that...I am somewhat aware that I will have tables with ranges:
for example: Table 1... 1 Child or 1 Bedroom with an array of Field1
$500 - $750 or 4 and 2 would return the result of Field 3
$110.00 or $135.00 Total

If field 1 is =1 route to table D1
If field 3 is >$500 and < $750 than Total1=$110.00

I hope I am explaining this correctly. I greatly appreciate your assistance.

Thanks,

Tim
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 12 2011, 04:03 AM
Post #6


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(TimT @ Oct 11 2011, 09:39 AM) *

QUOTE(Brian Chandler @ Oct 10 2011, 02:24 PM) *

QUOTE
I have a form base that I am collecting data from clients.


So you must be writing a server script to collect this data, and store it in a database... right? (If you are hoping to "collect data" in html, well, it isn't going to happen.)


No the database application I will be using will be MySQL, I just haven't gotten comfortable enough yet to tackle that...I am somewhat aware that I will have tables with ranges:
for example: Table 1... 1 Child or 1 Bedroom with an array of Field1
$500 - $750 or 4 and 2 would return the result of Field 3
$110.00 or $135.00 Total

If field 1 is =1 route to table D1
If field 3 is >$500 and < $750 than Total1=$110.00

I hope I am explaining this correctly. I greatly appreciate your assistance.

Thanks,

Tim


I'm afraid you are not explaining it so that I can understand what you want to do.

MySQL is a database system -- so you will be using a MySQL database server, but you will have to write a program to access this DB server (in PHP, Perl, or something else).

I think you need to do substantial reading of an introduction to databases in order to explain more clearly what you want to do. Even if you get someone to do it for you, you still need to be able to specify the functionality in a way they can understand.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 09:13 PM