Session Variable
Posted: Sat Apr 12, 2008 11:33 am
Passing date as session variable to another page doesn't seem to work. I have the following code
page1
<?php
$theDate = isset($_REQUEST["date2"]) ? $_REQUEST["date2"] : "";
$_SESSION["mySessionDateVariable"] = $theDate;
$myDate=$_SESSION["mySessionDateVariable"];
?>
<div align="center">
<input name="tvar" type="text" value="<?=$myDate ?>" id="tvar" />
page2
<?php
$user=$_SESSION['MM_Username'];
$aDate = $_SESSION['mySessionDateVariable'];
?>
<body class="oneColElsCtr">
<h1><a href="http://www.frankcooley.com"><img src="images/Banner.gif" width="753" height="235" /></a></h1>
<h1>Enter a Ride for This Date</h1>
<input type="text" name="temp" value="<?=$theDate ?>" size="32" />
The first text box prints the date. the second is blank. If I substitute a string like "04-12-2008" for the mySessionDateVariable on the page1, it works in both instances. I'm only a sometime php user, so I am a little confused.
Frank
page1
<?php
$theDate = isset($_REQUEST["date2"]) ? $_REQUEST["date2"] : "";
$_SESSION["mySessionDateVariable"] = $theDate;
$myDate=$_SESSION["mySessionDateVariable"];
?>
<div align="center">
<input name="tvar" type="text" value="<?=$myDate ?>" id="tvar" />
page2
<?php
$user=$_SESSION['MM_Username'];
$aDate = $_SESSION['mySessionDateVariable'];
?>
<body class="oneColElsCtr">
<h1><a href="http://www.frankcooley.com"><img src="images/Banner.gif" width="753" height="235" /></a></h1>
<h1>Enter a Ride for This Date</h1>
<input type="text" name="temp" value="<?=$theDate ?>" size="32" />
The first text box prints the date. the second is blank. If I substitute a string like "04-12-2008" for the mySessionDateVariable on the page1, it works in both instances. I'm only a sometime php user, so I am a little confused.
Frank