Justtechjobs.com Find a programming school near you






Online Campus Both


php-windows | 2003032

RE: [PHP-WIN] RE:[newbie]session problem From: Uttam (uttam <email protected>)
Date: 03/19/03

afaik, a session is handled as follows in later versions of php:

1. initiate session i.e. session_start(); this is required only if you do
not have session.auto_start=1 in php.ini.

2. Add session variables to global array $_SESSION[] like
$_SESSION['test']="test variable"

3. Access the session vaiable in subsequent calls as index of global
associative array $_SESSION[];
e.g. echo $_SESSION['test']

4. Finally, destroy the session when its no longer need by session_destroy()
and free the resources allocated to this particular session.

regds,

-----Original Message-----
From: toby z [mailto:blue_myth_1 <email protected>]
Sent: Tuesday, March 18, 2003 14:36
To: Bobby Rahman; php-windows <email protected>
Subject: Re: [PHP-WIN] RE:[newbie]session problem

hi
try this

initiate session on proc.php
// init sessn
session_start();

// register session variblez ! ! ! !
session_register("SESSN");

chech for session set on sum_page.php

<?php
// sessn chk ! ! ! !
session_start();
if(!session_is_registered("SESSN"))
{
// sessn chk failed .... invoke error hndlr ! ! ! !
header("Location: /nologn.php");
exit();
}

the rest of ur code .....

?>

hope thid helps

good luck

toby ....

 --- Bobby Rahman <bobby_rahman2002 <email protected>> wrote: >
>
> Hiya,
>
> Im running php4.2.3 on Win98 and apache 2.0.43.
> I am having troubles passing variables from page to page.
> I try to use:
>
> session_start();
> session_register("test");
>
>
> when echo $test on a different page it seems to be empty
> when not called from within the page originally created.
>
> I have session_start() on every page at the start just under the
> php syntax
> <? and also register the variables which I want global.
>
> I have edited the php.ini to set the session.save_path =
> "C:/windows/temp"
> and also have global variables set on
>
>
> Any suggestions to what it may be as it doesnt seem to produce any
> errors.
>
>
> Thanks
>
> _________________________________________________________________
> Express yourself with cool emoticons http://messenger.msn.co.uk
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php