Some ways to do it:
1. Session variable
2. hidden field in form
3. part of querystring
4. save in database table
Depends on security required for the variable and length of data.
If security is an issue, ie. you don't want anyone to be able to see it, then 2 and 3 are out.
If you don't want anyone to be able to change it (between pages), then 3 is out, cuz they have access to anything in the querystring.
If the variable could be a large amount of data, 3 is no good, since there's a limit on how long the querystring can be, and 1 may not be the best option as it uses up memory.
Also, if not all users will have cookies enabled, 1 is not good, since session variables require cookies enabled.
The most secure and most flexible is using a database, but if none of the above conditions apply, session variables are suitable also.