On Tuesday, February 19, 2002, at 02:52  PM, Phillip S. Baker wrote:

> Greetings all,
> I am looking for a good tutorial on the net about sessions.
> I have found a few but they do not seem to go in much detail about full 
> use.
> Can anyone suggest anything?

How's this:

1) Put session_start() at the top of any script in which you wish to use 

2) Use "$_SESSION['varname'] = $var;" to assign any variable to a 
session variable (assuming you are using PHP 4.1 or greater)

3) Keep in mind that users must have cookies enabled to store the 
session ID cookie, or you will have to plan for this by appending the 
SID to the querystring for each page in which you intend the session 
data to be accessible.

I.e. :

print "<tr><td><a href=\"http://domain.com/index.php?SID=$SID\";>Go 

Yes, this is a pain in the ass so if you want to use sessions 
extensively you can have PHP do it automatically by recompiling PHP with 
--enable-trans-id (I think, check the man for details).

4) Read the session-related functions' man pages

It's really very simple!  With PHP 4.1, you don't even need to use 
session_register() to assign session variables, just use (2) from above.


PS:  5) when you have specific questions ask the list


Erik Price
Web Developer Temp
Media Lab, H.H. Brown

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

Reply via email to