> <?php
> session_register("variable1");
> session_register("variable2");
> ?>
> <html>
> <body....(more html)
sometimes you have to include the session_start() to start the session
this can be overruled with the session.auto_start=1 in php.ini
> <?php
> $variable1 = 0;
> $variable2 = 1;
> ?>
> </body>
> </html>(end of document)
this is ok :-)
> <?php
> session_start(); //I included this line, because that's the only way
> ?> //I could figure out how to get to the session
> //variables.
this is not ok, the session has already started.
if you have trans_SID enabled in php,you won't need to urlencode the
session-ID, otherwise send it with the url.
with this you can simply access the variables like you have done before.
You could also set the variables with session_register("varname");
and retrieve them with $HTTP_SESSION_VARS["varname"]
> <?php
>
> if($variable1 > $variable2)
> {
> echo("var1 is bigger");
> }
> else
> {
> echo("var2 is bigger");
> }
> ?>
safest way to see if a session is started, is to check for the cookie
named "PHPSESSID" or to check if there is a folder created in your php.ini-
's session.save_path folder.
hope this helps,
Wouter Rusman