Macromedia dreamweaver 8-using dreamweaver User Manual

Page of 1030
Accessing data stored in session variables
681
Collecting information to store in session variables
Before creating a session variable, you must first obtain the information you want to store, 
then send it to the server for storage. This section describes how to gather and send 
information to the server using HTML forms or hypertext links containing URL parameters. 
You can also obtain information from cookies stored on the user’s computer, from the HTTP 
headers sent by the user’s browser with a page request, or from a database.
Related topics
Storing URL parameters in session variables
A typical example of storing URL parameters in session variables is a product catalog that uses 
hard-coded URL parameters created using a hypertext link to send product information back 
to the server to be stored in a session variable. When a user clicks the “Add to shopping cart” 
link, the product ID is stored in a session variable while the user continues to shop. When the 
user proceeds to the check-out page, the product ID stored in the session variable is retrieved. 
Storing form parameters in session variables
A form-based survey is a typical example of a page that stores form parameters in session 
variables. The form sends the selected information back to the server, where an application 
page scores the survey and stores the responses in a session variable to be passed to an 
application that might tally up the responses gathered from the survey population. Or the 
information might be stored in a database for later use.
Storing information in session variables
After information is sent to the server, you store the information in session variables by adding 
the appropriate code for your server model to the page specified by the URL or form 
parameter. Referred to as the destination page, this page is specified in either the 
action
 
attribute of the HTML form or the 
href
 attribute of the hypertext link on the starting page. 
The HTML syntax for each appears as follows:
<form action="destination.html" method="get" name="myform"> </form> 
<param name="href"value="destination.html">