sequence in php processing

jws2bay
jws2bay used Ask the Experts™
on
I have a web page where I am resetting  some session variables and and I also display the value of the session variable
   
$_SESSION['CurrentUser']="Guest";
$_SESSION['Username']="Guest";

<a href="W4_User_Quote_History.php"> User: <?php echo $_SESSION['CurrentUser']; ?></a>

I want the displayed value to be "Guest" , but it is not.  It shows the value before it is reset to "Guest".    I suspect it is because it is server-side php.
Is there a way to echo the session variable post the reassignment?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Principal Data Engineer
Commented:
Can you show some more of the code. Session variables hang around (keep their values that have been assigned to them) for every php page/script that has a session_start() as it's 1st statement.  It would be very hard to diagnose without knowing what is in any/all included files on the page that is giving you the issue.  The good news is it will be super-duper easy to diagnose where the issue is once we see the code.

For starters, on the page that is giving you problems, somewhere after session_start();  yuo should dump out what is in them.

var_dump($_SESSION);

Author

Commented:
Hi Mark,

Thanks for the replay.  Your reply made me examine my code a little closer.  Missing  the session_start() statement.  Sometimes
the obvious is hard to see.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial