Jump to content

session variables


natalieG

Recommended Posts

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]

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

[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
Link to comment
Share on other sites


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.
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.