Re: Can't establish sessions
| From: | Kelly Barrett | Date: | Thu, 08 Jun 2000 10:38:21 +0000 |
| Subject: | Re: Can't establish sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1277@lists.php.net to get a copy of this message | ||
> hi,
> i wanna to establish sessions for my site. but i don't seem to get it to
> work??
> here is the page where i register the "user name" to the session
> variable
>
> <?
> session_start();
> session_register("userid"); ?>
> <html>
> <title>First Page</title>
> <body>
> Welcome <? echo "$txtname from $REMOTE_ADDR\n";
> $userid=$txtname;
> echo "Welcome $userid again\n"; ?>
> <a href=./second.php>second </a>
> </body>
> </html>
>
> this is my other page "second.php"
> <?
> echo "HTTP_STATE_VARS = $HTTP_STATE_VARS";
> echo "userid = $userid";
> ?>
I think you need a session_start() there too, before it will load in any
registered variables, unless you set your session.auto_start in your php.ini
to 1.
So:
<?
session_start();
echo "HTTP_STATE_VARS = $HTTP_STATE_VARS";
echo "userid = $userid";
?>
Cheers,
Kelly.