This is a discussion on Looking for a $_SESSION clarification... within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I've been playing with $_SESSION and I have come across what seems strange to me but hopefully one of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've been playing with $_SESSION and I have come across what seems strange
to me but hopefully one of you understands and can explain it to me. I put together 4 pages based on info from the manual and the PHPSESSID is inconsistent in showing up in the address bar while the variables seem to follow just fine. Am I doing something wrong? (I'd prefer the ID not be there if that's a choice) But why is it showing up and then going away? Page one: -------------------------- <?php session_start(); $count = 5; $_SESSION["count"] = $count; $count2 = 10; $_SESSION["count2"] = $count2; ?> <br> Count is set to: [<?=$count?>].<br> <br> To continue, <a href="nextpage.php">click here</a>.<br> -------------------------- Page 2, 3, and 4 all look like this: -------------------------- <?php session_start(); ?> <br> Count is set to: [<?=$count?>].<br> Count2 is set to: [<?=$count2?>].<br> <br> To continue, <a href="nextpage2.php">click here</a>.<br> -------------------------- When I click on the link from the first page, the second page shows the ID in the URL. When I click on the link in the 2nd page and beyond, the ID is not in the URL anymore. However the variables still follow. Page one is making the link with the ID in it - which I understand is automatic because that option is turned on on my server, however why do the following pages not auto-add the ID as well, and why does it work even without the ID? If there is a way to set and access session variables without having the ID ever show up in the address bar, I'd prefer that method. Thanks in advance! -- Shawn Wilson |