After my last article about Session Management in PHP4, I got several
emails from people that had problems implementing what I tried to
describe. All theese emails had the same question:
Can you give me example code ? Yes, sure I can.
I will assume that you have read my previous article
(
it's here in case you missed it). As I described earlier, you
have to tell PHP that the current page use session variables by
calling the session_start() function. Once this function
is called, you are free to register any variable that you have bound as
a session variable. This is done using the session_register()
function.
What this does is that it registers the variable
my_session_variable as a session variable. This means that
the variable will be alive (keep it's value) across page-accesses, as
long as you call the session_start() function on all pages
that need access to the my_session_variable variable.