Equation breakdown
Posted: Mon Mar 05, 2012 1:35 pm
Hi
I have built a series of forms with PHP and have been using SESSIONS to carry values from one to another. In one, the value of a variable is determined by adding the values of several other variables together:
This equation is working fine on that page. I then place the value of $totalFixed in a SESSION variable:
I then assign this SESSION variable's value to a new variable on another page in the series:
The number displays fine on this page as well. However, when the value is above 1,000 and I try to subtract another number from it, it ignores everything to the right of the comma. For example, if $dataValue[4] is 10,132 and $dataValue[5] is 25 and I subtract $dataValue[4] from $dataValue[5], the result is -15.
Does anyone know the reason for this?
Many thanks,
Andy
I have built a series of forms with PHP and have been using SESSIONS to carry values from one to another. In one, the value of a variable is determined by adding the values of several other variables together:
Code: Select all
$totalFixed = $fixedCost1 + $fixedCost2 + $fixedCost3 + $fixedCost4 + $fixedCost5;Code: Select all
$_SESSION['totalFix']=$totalFixed;Code: Select all
$dataValue[4] = $_SESSION['totalFix'];Does anyone know the reason for this?
Many thanks,
Andy