Jump to content

Call variable stored in session inside a class


turner2000

Recommended Posts

Hi,

Sorry my PHP skills are very limited but I have tried for a while with this problem and haven't suceeded so I'm hoping someone can help me (if I can explain my problem in words that make sense  :-\ ).

Inside a function I have created a variable and saved it to the session ID using the following code:

[code]$_SESSION['current_price'] = $stripped3;[/code] where $stripped3 is a variable that I've stripped of tags and trimmed.

When I call that variable on another page on the site that doesn't include the function using the echo function it displays correctly.

If I try and call that variable inside a class the variable has a value of 0. Below is the code I am using to try and compare 2 variables:

[code]if ($products_ship_price > $current_price)
$this->shiptotal = ($products_ship_price);
else
$this->shiptotal = ($current_price);[/code]

How do I call the variable $current_price from a function and use it in this class?

I hope this makes sense.

Thanks in advance!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.