Jump to content


Photo

session variables


  • Please log in to reply
2 replies to this topic

#1 natalieG

natalieG
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 08 April 2006 - 12:42 AM

in the file index-2, we want to have a differenf banner[headerswish.html] the first
time the application is opened and after that we want the banner[statichead.html] to show.
we do start the application on the first line of the file with

session_start();

[MORE CODE]

<tr><td>
<?php if (isset($_SESSION['START']))
{include 'statichead.html';} else
{include 'headerswish.html';} ?>
</td></tr>


[MORE CODE TO LAST LINE]

$_SESSION['START']=1;

What happens is that even on the first execution, before $_SESSION['START'] is set,
the banner headersawish is shown. So, it acts liuke the session variable is always set.

Thanks,

Jennifer


#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 08 April 2006 - 02:41 AM


First delete any session cookies and/or exit the browser before each test (I'm assuming that you're using default php.ini settings).

The first time it should include headerswish, and there after statichead (until session expires).

What you stated is what is supposed to happen: "...on the first execution, before $_SESSION['START'] is set, the banner headersawish is shown."

If after the first time it keeps showing headerswith, then it means your sessions are NOT being saved. See my session troubleshooting post in the FAQ page pinned at the top of the newbie topic area for help.


#3 natalieG

natalieG
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 08 April 2006 - 02:42 PM

Yor are correct!. Thanks very much


Jen




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users