Sessions and static pages

liunx

Guest
I have a page (page1.html) that calls an include file (GLOBALS.HTM) that calls my sessions file (sessions.php), all through a server side include. (It's a little convoluted, but I have to work with the current site setup for this client.):

This is the portion of page1.html that calls GLOBALS.HTM -
<!--#include virtual="/IN/GLOBALS.HTM" -->
<html>
.
.
.

This is the portion of GLOBALS.HTM that calls sessions.php -
<!--#include virtual="sessions.php" -->
.
.
.

This is sessions.php -
<?php
session_start();

if(isset($_SESSION['test'])) {

// Its registered so display it
echo $_SESSION['test'];
echo "<br />The above text should say hello";

} else {

echo "The session was not set, but now is";
$_SESSION['test'] = "Hello World!";
}
?>

When I call sessions.php directly in the browser, it works as expected. When I call page1.html in the browser, sessions.php does not behave the way I expected it to (which is the way it behaves when I call it directly.) Instead, it acts as if the session was not set on every refresh.

I thought that if the session cookie was set, it would automatically be passed to the next page or to the same page in the headers when the page refreshed. Why is that not happening? Is it because page1.html is static? What am I not understanding?

Thanks!

P.S. Our web server is setup to parse these SSIs already and is doing so successfully.
 
Back
Top