Hi, I'm currently writing a mulit-page form app that uses a session to
retain data from each form element in order for the user to jump
between pages, then the final data is passed to a calculation script.
However, I've noticed that if I assign a session variable to another
variable, which then performs a mathematical calculation, the session
variable changes.
i.e. $_SESSION["inflation"] = 4;
$temp_inf = $_SESSION["inflation"];
if ($_SESSION["inflation"] =="RPI") {
$inflation = $rpi;}
else {$inflation = ($temp_inf/100.0);}
now it equals = 0.04
How can I take a value from a session and perform operations on it
without altering the original session value.
Rgds
Neil.
retain data from each form element in order for the user to jump
between pages, then the final data is passed to a calculation script.
However, I've noticed that if I assign a session variable to another
variable, which then performs a mathematical calculation, the session
variable changes.
i.e. $_SESSION["inflation"] = 4;
$temp_inf = $_SESSION["inflation"];
if ($_SESSION["inflation"] =="RPI") {
$inflation = $rpi;}
else {$inflation = ($temp_inf/100.0);}
now it equals = 0.04
How can I take a value from a session and perform operations on it
without altering the original session value.
Rgds
Neil.
Comment