<?
//All of this code should be before any HTML, and preferably at the beginning at a file
// This starts a session with the user
start_session();
// Register whatever variables you want to use in the whole session
register('variable1');
register('variable2');
?>
Then use $variable1 and $variable2 later in your script like a normal variable.
If you want to use them in another script, put a session_start() at the beginning of the other script, and the variables you registered and manipulated in the first one will be available.
Hope this helps.