Re: New on PHP, need help with sessions
| From: | mike cullerton | Date: | Tue, 03 Jul 2001 06:35:26 +0000 |
| Subject: | Re: New on PHP, need help with sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55934@lists.php.net to get a copy of this message | ||
on 7/3/01 12:19 AM, Victor Spång Arthursson at victor@miceandbrains.dk
wrote:
> Hi!
>
> I'm converting from ASP/VBScript, and need to know how to declare a
> session variable.
i feel your pain. i just finished moving a site from ASP/VBScript to
PHP/Javascript, learning ASP/VBScript and Javascript along the way :)
>
> In VBScript I just type in:
>
> <%
> session("any") = "victor"
> %>
>
> Then I can print that variable on any page on the same webpage using:
>
> <%
> response.write session("any")
> %>
>
> as long as I don't close the browser or the variable times out.
>
> Question: How do I achieve the same thing in PHP..?
you'll want to take a look at http://www.php.net/manual/en/ref.session.php
you can start a session by starting it or by registering a variable.
session_start()
session_register("variablename")
once set, the variables are available as $HTTP_SESSION_VARS["variablename"]
or (depending on how php is configured) $variablename.
on my macos x box, $variablename does work.
>
> Thanks in advance,
>
> Sincerely Victor
>
> PS Using PHP 4 on Mac OS X DS
-- mike cullerton