using session to make a calculator

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mckooter
Forum Commoner
Posts: 26
Joined: Fri Jul 28, 2006 10:02 pm

using session to make a calculator

Post by mckooter »

okay from a recent post of mine i made a session variable, now using these variables i plan to do calculations, by doing that i first call the session to a regular variable (simply because i made the calculation using regular variables)

Code: Select all

$aloan1 = $_SESSION['aloan1'];
then that variable is used later in program as a number for a calculation, something like this

Code: Select all

$taloan = ($aloan1 + $aloan2 + $aloan3 + $aloan4 + $aloan5 + $aloan6 + $aloan7 + $aloan8 + $aloan9 + $aloan10);
( i realise that is probably the long way of doing something but im learning)

now after getting that $taloan variable i run an if statement on it (something like:)

Code: Select all

if ($under10k == "yes" and $vestbal <= 10000)
{
	$fcalc1 = ($vestbal - $taloan - $tdloan - $taint);
}
(note there are some variables i did not include above for relevance and legnth of post)



when i process page i get this error:
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
now after looking at this register_globals I assume mine is turned off because im not getting a result, now does this mean that i cannot use these sessions variables to send data for calculations?

I believe i have confused myself with my first script and hopefully the above post is understandable
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you should be able to use session variables just like any other variables... just don't use session_register() and session_unregister()
Post Reply