Re: How can I get my session variable to pass to another page?
| From: | Martin Clifford | Date: | Fri, 26 Jul 2002 20:12:25 +0000 |
| Subject: | Re: How can I get my session variable to pass to another page? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109874@lists.php.net to get a copy of this message | ||
You have to have session_start() in each page in order to carry over session variables. :o)
Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/
>>> "DonPro" <donpro@lclcan.com> 07/26/02 04:06PM >>>
Hi,
I have a form that calls a PHP script which sets a session variable and
redirects to anopther URL as such:
session_start();
$HTTP_SESSION_VARS['userid'] = "someidnumber";
Header('Location: ' . 'http://www.mydomain.com/welcome.html');
On welcome.html, I have the following code:
<script language="php">
echo 'userid: ' . $HTTP_SESSION_VARS['userid'] . '<br/>';
</script>
When I run it in my browser, the value of 'userid' is empty. Anyone know
why?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php