FW: [PHP-WIN] basic variable question

2003-02-14 Thread Svensson, B.A.T. (HKG)

Obviously you are on to *somthing* with your first
comment, because one way to evaluate to 1.1 each
time is if for instance:

 $taxrate = 0.10; // local sales tax is %10
 $totalamount = $totalamount * (1 + $taxrate);

Is evaluated like:

  $totalamount * (1 + $taxrate)
  == 1 * (1 + 0.1)
  == 1 * 1.1 == 1.1


 -Original Message-
 From: Matt Hillebrand [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 13, 2003 8:34 PM
 To: 'paradiddles'; [EMAIL PROTECTED]
 Subject: RE: [PHP-WIN] basic variable question
 
 
 Oh wait. Yes you are. Heck if I know. :)
 
 |-Original Message-
 |From: paradiddles [mailto:[EMAIL PROTECTED]] 
 |Sent: Thursday, February 13, 2003 1:00 PM
 |To: [EMAIL PROTECTED]
 |Subject: [PHP-WIN] basic variable question
 |
 |
 |
 |  Hi everyone. Why does my code work when I enter just 1 for 
 |the quantity, but only returns $1.10 when I enter a quantity 
 |of 2 or more? 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-WIN] basic variable question

2003-02-13 Thread paradiddles

  Hi everyone. Why does my code work when I enter just 1 for the quantity, but only 
returns $1.10 when I enter a quantity of 2 or more? 

 

   $totalqty = 0.00;
   $totalamount = 0.00;

   define(HALLTABLE, 800);

   $totalqty =  $_POST[hallqty]; //quantity

   $totalamount =  $_POST[hallqty] * HALLTABLE; //total cost

$totalamount = number_format($totalamount, 2);
 echo $totalamount;
 echo br\n;
 echo Items ordered:  .$totalqty.br\n;
 echo Subtotal:   $.$totalamount.br\n;

 $taxrate = 0.10; // local sales tax is %10
 $totalamount = $totalamount * (1 + $taxrate);

 $totalamount = number_format($totalamount, 2);


 echo br\n;
 echo Total including tax: $.$totalamount.br\n;

 




forget your lust for the rich man's gold. All that you need, is in your soul. You can 
do this if you try. All that I want for you my son, is to be satisfied

  ~ Lynard Skynard



RE: [PHP-WIN] basic variable question

2003-02-13 Thread Matt Hillebrand
You're not using the $totalqty variable in any of the statements that
modify the $totalamount.

Matt

|-Original Message-
|From: paradiddles [mailto:[EMAIL PROTECTED]] 
|Sent: Thursday, February 13, 2003 1:00 PM
|To: [EMAIL PROTECTED]
|Subject: [PHP-WIN] basic variable question
|
|
|
|  Hi everyone. Why does my code work when I enter just 1 for 
|the quantity, but only returns $1.10 when I enter a quantity 
|of 2 or more? 
|
| 
|
|   $totalqty = 0.00;
|   $totalamount = 0.00;
|
|   define(HALLTABLE, 800);
|
|   $totalqty =  $_POST[hallqty]; //quantity
|
|   $totalamount =  $_POST[hallqty] * HALLTABLE; //total cost
|
|$totalamount = number_format($totalamount, 2);
| echo $totalamount;
| echo br\n;
| echo Items ordered:  .$totalqty.br\n;
| echo Subtotal:   $.$totalamount.br\n;
|
| $taxrate = 0.10; // local sales tax is %10
| $totalamount = $totalamount * (1 + $taxrate);
|
| $totalamount = number_format($totalamount, 2);
|
|
| echo br\n;
| echo Total including tax: $.$totalamount.br\n;
|
| 
|
|
|
|
|forget your lust for the rich man's gold. All that you need, 
|is in your soul. You can do this if you try. All that I want 
|for you my son, is to be satisfied
|
|  ~ Lynard Skynard
|



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-WIN] basic variable question

2003-02-13 Thread Matt Hillebrand
Oh wait. Yes you are. Heck if I know. :)

|-Original Message-
|From: paradiddles [mailto:[EMAIL PROTECTED]] 
|Sent: Thursday, February 13, 2003 1:00 PM
|To: [EMAIL PROTECTED]
|Subject: [PHP-WIN] basic variable question
|
|
|
|  Hi everyone. Why does my code work when I enter just 1 for 
|the quantity, but only returns $1.10 when I enter a quantity 
|of 2 or more? 
|
| 
|
|   $totalqty = 0.00;
|   $totalamount = 0.00;
|
|   define(HALLTABLE, 800);
|
|   $totalqty =  $_POST[hallqty]; //quantity
|
|   $totalamount =  $_POST[hallqty] * HALLTABLE; //total cost
|
|$totalamount = number_format($totalamount, 2);
| echo $totalamount;
| echo br\n;
| echo Items ordered:  .$totalqty.br\n;
| echo Subtotal:   $.$totalamount.br\n;
|
| $taxrate = 0.10; // local sales tax is %10
| $totalamount = $totalamount * (1 + $taxrate);
|
| $totalamount = number_format($totalamount, 2);
|
|
| echo br\n;
| echo Total including tax: $.$totalamount.br\n;
|
| 
|
|
|
|
|forget your lust for the rich man's gold. All that you need, 
|is in your soul. You can do this if you try. All that I want 
|for you my son, is to be satisfied
|
|  ~ Lynard Skynard
|



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-WIN] basic variable question

2003-02-13 Thread Matt Hillebrand
If you remove the first call to number_format(), it works.

Matt

|-Original Message-
|From: paradiddles [mailto:[EMAIL PROTECTED]] 
|Sent: Thursday, February 13, 2003 1:00 PM
|To: [EMAIL PROTECTED]
|Subject: [PHP-WIN] basic variable question
|
|
|
|  Hi everyone. Why does my code work when I enter just 1 for 
|the quantity, but only returns $1.10 when I enter a quantity 
|of 2 or more? 
|
| 
|
|   $totalqty = 0.00;
|   $totalamount = 0.00;
|
|   define(HALLTABLE, 800);
|
|   $totalqty =  $_POST[hallqty]; //quantity
|
|   $totalamount =  $_POST[hallqty] * HALLTABLE; //total cost
|
|$totalamount = number_format($totalamount, 2);
| echo $totalamount;
| echo br\n;
| echo Items ordered:  .$totalqty.br\n;
| echo Subtotal:   $.$totalamount.br\n;
|
| $taxrate = 0.10; // local sales tax is %10
| $totalamount = $totalamount * (1 + $taxrate);
|
| $totalamount = number_format($totalamount, 2);
|
|
| echo br\n;
| echo Total including tax: $.$totalamount.br\n;
|
| 
|
|
|
|
|forget your lust for the rich man's gold. All that you need, 
|is in your soul. You can do this if you try. All that I want 
|for you my son, is to be satisfied
|
|  ~ Lynard Skynard
|



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php