Accessing data stored in session variables

Accessing data stored in session variables

Session variables provide a mechanism through which user information can be stored and accessed for use by web applications. Typically, session variables store information (usually form or URL parameters submitted by users) and make that information available to all of the application’s pages for the duration of the user’s visit. For example, when users log on to a web portal that provides access to e-mail, stock quotes, weather reports, and daily news, the web application stores the login information in a session variable that identifies the user throughout the site’s pages. This allows the user to see only the types of content they have selected as they navigate through the site. Session variables can also provide a safety mechanism in the form of a time-out that terminates the user’s session if the account remains inactive for too long a period of time. This also frees server memory and processing resources if the user forgets to log off a website.

Session variables are commonly used to store user display preferences, answers to multipart questionnaires, items chosen for purchase in so-called "shopping cart" applications, and running score tallies for online games.

This section covers the following topics:

  • Understanding session variables
  • Collecting information to store in session variables
  • Storing information in session variables
  • Example of information stored in session variables
  • Retrieving data from session variables


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly