doing math with html

doing math with html

am 22.05.2007 17:51:57 von lrbtav

I need to do some simple math with a website. For example, I need
about 12 input boxes, some need to take a value and multiply by
another box, others need to be multiplied by a constant number. I have
an excel spreadsheet doing this but need to put it on a website.

What's the easiest way to accomplish this? Can I use html or do I need
to use php or something? Thanks!

Re: doing math with html

am 22.05.2007 18:00:18 von jkorpela

Scripsit lrbtav:

> I need to do some simple math with a website.

Do you, really?

> For example, I need
> about 12 input boxes, some need to take a value and multiply by
> another box, others need to be multiplied by a constant number. I have
> an excel spreadsheet doing this

Fine.

> but need to put it on a website.

Do you, really? Why?

> What's the easiest way to accomplish this? Can I use html or do I need
> to use php or something?

You can't do any math in html. Not even 1 + 1. If you thought otherwise, you
had a completely wrong idea of what html is.

> Thanks!

You're welcome.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Re: doing math with html

am 22.05.2007 18:07:10 von lws4art

lrbtav wrote:
> I need to do some simple math with a website. For example, I need
> about 12 input boxes, some need to take a value and multiply by
> another box, others need to be multiplied by a constant number. I have
> an excel spreadsheet doing this but need to put it on a website.
>
> What's the easiest way to accomplish this? Can I use html or do I need
> to use php or something? Thanks!
>
HTML is just markup, not a programing language...it just says this is a
paragraph, this is a list item, and this is a heading. What you need is
some sort of scripting,

1) JavaScript is client-side
PROS: fast updating of values because it works on the visitors computer
CONS: not dependable, the client may not have JavaScript enabled or
available.

2) CGI (Perl, PHP, ASP ...)
PROS: dependable, not dependent on client
CONS: requires values to be sent to server to be processed or updated.



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Re: doing math with html

am 22.05.2007 18:30:52 von Toby A Inkster

lrbtav wrote:

> What's the easiest way to accomplish this? Can I use html or do I need
> to use php or something? Thanks!

You need to use PHP or something. Probably the easiest "something" for you
to get started with is Javascript.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 88 days, 15 min.]

The Great Wi-Fi Controversy
http://tobyinkster.co.uk/blog/2007/05/22/wifi-scare/

Re: doing math with html

am 22.05.2007 21:02:45 von Neredbojias

On Tue, 22 May 2007 15:51:57 GMT lrbtav scribed:

> I need to do some simple math with a website. For example, I need
> about 12 input boxes, some need to take a value and multiply by
> another box, others need to be multiplied by a constant number. I have
> an excel spreadsheet doing this but need to put it on a website.
>
> What's the easiest way to accomplish this? Can I use html or do I need
> to use php or something? Thanks!

One way would be to use a form and its associated script.

If you're new to scripting in general, study-up.

--
Neredbojias
He who laughs last sounds like an idiot.

Re: doing math with html

am 22.05.2007 22:39:38 von cwdjrxyz

On May 22, 10:51 am, lrbtav wrote:
> I need to do some simple math with a website. For example, I need
> about 12 input boxes, some need to take a value and multiply by
> another box, others need to be multiplied by a constant number. I have
> an excel spreadsheet doing this but need to put it on a website.
>
> What's the easiest way to accomplish this? Can I use html or do I need
> to use php or something? Thanks!

As others have indicated, doing math is not part of html. You can use
javascript, but you have quite a bit to learn if you have never used
it before. The Usenet group comp.lang.javascript covers javascript,
and their FAQs are at http://jibbering.com/faq/index.html . Perhaps
the most often used server side language for doing math is php, and
many hosts that sell web space often have php installed on their
servers these days. As far as the math goes, the code written in php
looks much like javascript code in many respects. This is not always
an advantage, since if you are used to writing javascript it is all
too easy to make an error when writing php in cases where the two
languages vary slightly. Learning php also can take considerable time.
Also you need to be very careful when writing server side script of
any kind with input forms. Hackers can put scripts, etc into your
forms that can do very nasty things if you do not control what you can
input into the forms very carefully. Pages have been defaced, deleted,
or a whole server has been crashed by some such hacker tricks.

Re: doing math with html

am 23.05.2007 00:58:03 von wayne

cwdjrxyz wrote:
> On May 22, 10:51 am, lrbtav wrote:
>> I need to do some simple math with a website. For example, I need
>> about 12 input boxes, some need to take a value and multiply by
>> another box, others need to be multiplied by a constant number. I have
>> an excel spreadsheet doing this but need to put it on a website.
>>
>> What's the easiest way to accomplish this? Can I use html or do I need
>> to use php or something? Thanks!
>
> As others have indicated, doing math is not part of html. You can use
> javascript, but you have quite a bit to learn if you have never used
> it before. The Usenet group comp.lang.javascript covers javascript,
> and their FAQs are at http://jibbering.com/faq/index.html . Perhaps
> the most often used server side language for doing math is php, and
> many hosts that sell web space often have php installed on their
> servers these days. As far as the math goes, the code written in php
> looks much like javascript code in many respects. This is not always
> an advantage, since if you are used to writing javascript it is all
> too easy to make an error when writing php in cases where the two
> languages vary slightly. Learning php also can take considerable time.
> Also you need to be very careful when writing server side script of
> any kind with input forms. Hackers can put scripts, etc into your
> forms that can do very nasty things if you do not control what you can
> input into the forms very carefully. Pages have been defaced, deleted,
> or a whole server has been crashed by some such hacker tricks.
>

As I understand PHP, the programmer must check each field for valid
input characters. Wouldn't this keep hackers at bay?

--
Wayne
www.glenmeadows.us
"I cannot imagine a God who rewards and punishes the objects of his
creation, whose purposes are modeled after our own -- a God, in short,
who is but a reflection of human frailty. Neither can I believe that the
individual survives the death of his body, although feeble souls harbor
such thoughts through fear or ridiculous egotism." [Einstein]

Re: doing math with html

am 23.05.2007 07:21:33 von Adrienne Boswell

Gazing into my crystal ball I observed wayne writing in
news:%zK4i.14082$j63.8233@newsread2.news.pas.earthlink.net:

> Pages have been defaced, deleted,
>> or a whole server has been crashed by some such hacker tricks.
>>
>
> As I understand PHP, the programmer must check each field for valid
> input characters. Wouldn't this keep hackers at bay?
>
>

Not necessarily. A determined hacker can get past server side checks, if
the check is not strong enough. A good example of that is SQL injection,
where the page is using dynamic SQL, and the developer is either not using
stored procedures, or is not testing for single quotes in input fields.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Re: doing math with html

am 23.05.2007 08:32:00 von Toby A Inkster

Adrienne Boswell wrote:
> wayne:
>
>> As I understand PHP, the programmer must check each field for valid
>> input characters. Wouldn't this keep hackers at bay?
>
> Not necessarily. A determined hacker can get past server side checks, if
> the check is not strong enough. A good example of that is SQL injection,
> where the page is using dynamic SQL, and the developer is either not using
> stored procedures, or is not testing for single quotes in input fields.

Surely, "not testing for single quotes" falls into the category of not
"check[ing] each field for valid input characters"?

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 88 days, 14:15.]

The Great Wi-Fi Controversy
http://tobyinkster.co.uk/blog/2007/05/22/wifi-scare/

Re: doing math with html

am 23.05.2007 09:23:52 von Adrienne Boswell

Gazing into my crystal ball I observed Toby A Inkster
writing in
news:0o3di4-s96.ln1@ophelia.g5n.co.uk:

> Adrienne Boswell wrote:
>> wayne:
>>
>>> As I understand PHP, the programmer must check each field for valid
>>> input characters. Wouldn't this keep hackers at bay?
>>
>> Not necessarily. A determined hacker can get past server side
>> checks, if the check is not strong enough. A good example of that is
>> SQL injection, where the page is using dynamic SQL, and the developer
>> is either not using stored procedures, or is not testing for single
>> quotes in input fields.
>
> Surely, "not testing for single quotes" falls into the category of not
> "check[ing] each field for valid input characters"?
>

You would be surprised - there's stored procedures where it doesn't
matter, and there's replacing single quotes with another character, a
tidle is often a choice. Some developers are working with Access
databases, and don't know how/what a stored procedure is. If the
developer doesn't write it into a function, and has to write field =
replace(field,"'","~") a whole bunch of times, they can get lazy and
forget one - for example a phone number. The developer thinks "Oh, phone
numbers don't have single quotes, and no one is going to put a single
quote in a phone number, so no need for a check" -- and that's where the
injection takes place.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Re: doing math with html

am 24.05.2007 11:03:27 von wayne

Adrienne Boswell wrote:
> Gazing into my crystal ball I observed Toby A Inkster
> writing in
> news:0o3di4-s96.ln1@ophelia.g5n.co.uk:
>
>> Adrienne Boswell wrote:
>>> wayne:

>> Surely, "not testing for single quotes" falls into the category of not
>> "check[ing] each field for valid input characters"?
>>
>
> You would be surprised - there's stored procedures where it doesn't
> matter, and there's replacing single quotes with another character, a
> tidle is often a choice. Some developers are working with Access
> databases, and don't know how/what a stored procedure is. If the
> developer doesn't write it into a function, and has to write field =
> replace(field,"'","~") a whole bunch of times, they can get lazy and
> forget one - for example a phone number. The developer thinks "Oh, phone
> numbers don't have single quotes, and no one is going to put a single
> quote in a phone number, so no need for a check" -- and that's where the
> injection takes place.
>

If you were copying files to your web server, wouldn't you check
permissions so others could not write to them? If you set any of the
permissions to "777" and your web site is compromised, isn't that your
fault?

If a developer is writing databases, he/she MUST test all fields and
code. Part of testing requires entering characters not needed for a
field (like special characters in numerical or text fields) and see if
the form allows this. If the developer does not do this, there are
plenty of hackers that will test the code for them ;


--
Wayne
www.glenmeadows.us
"I cannot imagine a God who rewards and punishes the objects of his
creation, whose purposes are modeled after our own -- a God, in short,
who is but a reflection of human frailty. Neither can I believe that the
individual survives the death of his body, although feeble souls harbor
such thoughts through fear or ridiculous egotism." [Einstein]