would header() ever kill a session? - noob [solved]
Posted: Mon Jan 23, 2006 1:00 pm
sorry in advance. I can't seem to get a variable to pass while using sessions.
Here's the page1.php (after a user submitted a form)
Then, on to page2.php:
On both pages, there is nothing before the opening php tags.
I've also tried removing the header() on page1.php, and applying the
code just to test it out, and it worked fine on page one.
i just can't seem to get the variable to pass on to page 2. Thanks in advance. Mondays are fun.
Here's the page1.php (after a user submitted a form)
Code: Select all
<?PHP
session_start();
header("Cache-control: private");
if(isset($_POST["submit"] )) {
// connect stuff here, etc.
// other non-important code here
$refnumber= // date function to generate *unique* reference number;
$_SESSION['milkdudsrule'] = $refnumber;
header( "Location: http://www.sinbadisgettingold.com/page2.php" );
}
?>Code: Select all
<?PHP
session_start();
header("Cache-control: private");
?>
some zippy html here. Your reference number is:
<?PHP
if ( isset( $_SESSION['milkdudsrule'] ) ) {
echo "$refnumber";
}
else {
echo "could not start session";
}
?>I've also tried removing the header() on page1.php, and applying the
Code: Select all
if ( isset( $_SESSION['milkdudsrule'] ) ) {
echo "$refnumber";
}
else {
echo "could not start session";
}i just can't seem to get the variable to pass on to page 2. Thanks in advance. Mondays are fun.