|
Posted by Newbie Supreme on 09/28/37 11:42
I'm practicing using form fields to add, subtract, multiply, etc., and send
that data to pages as well as to email scripts. It seems I'm decent with
basic calculations, but when it comes to things like adding an amount if a
certain checkbox is clicked, or using if/thens, I'm totally at a loss.
Can anyone show me the php used to do the following:
Page 1 has Field1, Field2, and Field3, all textboxes. It also has Check1
and Check2 These are checkboxes.
How can page two show the result of:
((Field1 + Field2) x Field3) + 300 if Check1 is checked (0 if not) + 100 if
Check2 is checked (0 if not)
For example, if on the 1st page the user puts 10 in Field1, 5 in Field2, and
4 in Field3, then checks Check2, the result is 160 (10 + 5, multiplied by 4,
then adding 100).
Any help is appreciated, or if you know of a website that shows caluclations
with form fields in PHP, going from basic to complex, I would love to find
it. I found one for ASP that was very helpful, it shows the code and had
example pages for progressively more complicated calculations, with very
small increments of difficulty, so you could learn very quickly.
Thanks for reading.
Navigation:
[Reply to this message]
|