Date: 10/15/01
- Next message: ArsenKirillov: "[PHP] FW: How to print the registered session variables??"
- Previous message: Andrey Hristov: "Re: [PHP] time();"
- In reply to: Balaji Ankem: "[PHP] How to print the registered session variables??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<Original message>
From: Balaji Ankem <balaji.ankem <email protected>>
Date: Mon, Oct 15, 2001 at 11:14:03AM +0530
Message-ID: <011601c1553c$67b071e0$1702910a <email protected>>
Subject: [PHP] How to print the registered session variables??
> Hi,
> I have registered two session variables with the names user and pw.
>
> Please tell me how to print those session vars??
>
> Is it needed to call session_register("varname") before printing the
> session variable "varname"??
>
> Thanks and regards
> -Balaji
</Original message>
<Reply>
Hi there :)
It all depends... If you're on a next/different page then where
you've 'started' the session-vars you first have to call
session_start(). After that you can either do:
print ($varname);
or (better):
print ($HTTP_SESSION_VARS["varname"]);
If you're still on the same page as where you 'start' the
session-vars, there are two ways:
First register the variables (otherwise they're not session-vars),
and then you can print them in two ways:
session_register ("varname");
and then:
print ($varname);
or (better):
print ($HTTP_SESSION_VARS["varname"]);
The other way is (when you're still on the same page) to not use
them as session-vars at all (ofcourse depending on what you want to
do with 'm). Then they're still just normal vars ;) :
print ($varname);
If you want to check which session-vars you have available do:
print_r ($HTTP_SESSION_VARS);
or (more info):
var_dump ($HTTP_SESSION_VARS);
Ofcourse you need to call session_start() before this...
</Reply>
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze <email protected> -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: ArsenKirillov: "[PHP] FW: How to print the registered session variables??"
- Previous message: Andrey Hristov: "Re: [PHP] time();"
- In reply to: Balaji Ankem: "[PHP] How to print the registered session variables??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

