Defining session variables

Defining session variables

You can use session variables to store and display information maintained for the duration of a user’s visit (or session). The server creates a different session object for each user and maintains it for a set period of time or until the object is explicitly terminated. For more information, see Understanding session variables.

Before defining session variables for a page, you must create them in the source code. For instructions, see the following topics:

  • Collecting data submitted by users
  • Accessing data stored in session variables
  • Storing information in session variables

After you create a session variable in the web application’s source code, you can use Dreamweaver to retrieve its value and use it in a web page.

To define a predefined session variable:

  1. Create a session variable in the source code and assign a value to it.

    For example, this ColdFusion example instantiates a session called username, and assigns it the value Cornelius:

    <CFSET session.username = Cornelius>
    
  2. Select Window > Bindings to display the Bindings panel.
  3. Click the Plus (+) button and select Session Variable from the pop-up menu.
  4. Enter the name of the variable you defined in the source code.
  5. Click OK.

    The session variable appears in the Bindings panel.

    This is a picture of the feature being described.

Once you define the session variable, you can use its value in your page. For more information, see Adding Dynamic Content to Web Pages.

Related topics

  • Collecting data submitted by users
  • Accessing data stored in session variables
  • Understanding session variables
  • Storing information in 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