Please help, this is driving me nuts!
Basically, i have an include file that checks for a value set in a session variable. But it will always return a blank value.
I can get it working if i copy everything out of the include file and paste it into the file i'm calling it from without a problem. But since i will need this script in every one of my pages, i hoped to use an include.
I've searced the web/google groups but not found anything relating to this issue that was resolved.
Any suggestions?
TIA
Caff
Index.php
main.php
This works fine, if however i use the following as index.php, it returns a blank value for the session variable
using include.php
These files have been vastly simplified in my effort to get to the bottom of this problem.
Basically, i have an include file that checks for a value set in a session variable. But it will always return a blank value.
I can get it working if i copy everything out of the include file and paste it into the file i'm calling it from without a problem. But since i will need this script in every one of my pages, i hoped to use an include.
I've searced the web/google groups but not found anything relating to this issue that was resolved.
Any suggestions?
TIA
Caff
Index.php
Code:
<?php
session_start();
echo("season: ".$_SESSION['seas']);
?>
<br /><a href="main.php?s=1">1</a>
<br /><a href="main.php?s=2">2</a>
main.php
Code:
<?php
session_start();
$s = $_GET['s'];
$_SESSION['seas']=$s;
header("location: index.php");
?>
This works fine, if however i use the following as index.php, it returns a blank value for the session variable
Code:
<?php
include("include.php");
echo("season: ".$s);
?>
<br /><a href="main.php?s=1">1</a>
<br /><a href="main.php?s=2">2</a>
using include.php
Code:
<?php
session_start();
$s = $_SESSION['seas']);
?>
These files have been vastly simplified in my effort to get to the bottom of this problem.