Jump to content


Photo

clearing out session variables


  • Please log in to reply
2 replies to this topic

#1 SCook

SCook
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 13 September 2006 - 03:04 PM

Hi gang,

I seem to be having trouble assigning new values to session variables that I've created after they've received an initial values, like so:
$_SESSION['var'] = 25.5;

Then I try to do this:
$_SESSION['var'] = 30.1;

and I get as an output 0.  What's with that?  Thanks.

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 13 September 2006 - 03:13 PM

you may have to be a little more specific. are you using session_start() at the top of your pages? also, are you assigning values on one page and then trying to access them from another, or are they all on the same page?
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 SCook

SCook
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 13 September 2006 - 03:17 PM

Yes, I am using session_start at the tops of each page, as I'm using a session-based secure login.

Now, what's happening is that these values are assigned on the final order page, and then for example, the customer goes back to the home page and places another order.  They then submit it, and it goes to the final order page, where the order info, quantity, price, etc. are reassigned to the session varibles.  Then these are read further down in the page.  I don't have to do this, but some of these values are used again, so it's a convenient method.

Now, because the session variables are still holding the info from the last order, they don't seem to accept new values.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users