Re: Session and Header function
| From: | Charlie Killian | Date: | Wed, 23 Jan 2002 22:44:42 +0000 |
| Subject: | Re: Session and Header function | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11607@lists.php.net to get a copy of this message | ||
Make sure you session_write_close() before you redirect so the session data
has a chance to be written.
Charlie
"St Ooi" <stooi@tas-my.com> wrote in message
news:005001c1a302$9d1f97c0$0100000a@mis...
I have a problem with session and redirection. I have setup 2 testing file.
index.php will start the session, set the
session variable and redirect it to index-full.php.
However, in index-full.php, I cannot see the output that I expected. it
should be "trial is Ooi Soo Tuck". The output
is "trial is" which mean that the session variable is not registered or
expired.
If I remove the header function and replace it with a link to
index-full.php, I get the output that I expected.
Why header function will cause session not working?
(index.php)
<?
session_start();
$trial="Ooi Soo Tuck";
session_register("trial");
header("Location: index-full.php");
exit;
?>
(index-full.php)
<?
session_start();
print ("trial is ".$trial);
?>
any help would be appreciated.
Thanks
ST Ooi
Malaysia