About url and form parameters, About session variables, How session variables work – Adobe Dreamweaver CC 2015 User Manual
Page 569

562
Dynamic sites, pages and web forms
Last updated 6/3/2015
Database queries are written in Structured Query Language (SQL, pronounced “sequel”), a simple language that allows
you to retrieve, add, and delete data to and from a database. The SQL builder included with Dreamweaver lets you
create simple queries without having to understand SQL. However, if you want to create complex SQL queries, a basic
knowledge of this language lets you create more advanced queries, and provides you with greater flexibility in designing
dynamic pages.
Before you define a recordset for use with Dreamweaver, you must create a connection to a database and—if no data
exists yet—enter data into the database. If you have not yet defined a database connection for your site, refer to the
database connection chapter for the server technology you are developing for, and follow the instructions on creating
a database connection.
About URL and form parameters
URL parameters store retrieved information input by users. To define a URL parameter you create a form or hypertext
link that uses the GET method to submit data. The information is appended to the URL of the requested page and
communicated to the server. When using URL variables, the query string contains one or more name-value pairs that
are associated with the form fields. These name-value pairs are appended to the URL.
Form parameters store retrieved information that is included in the HTTP request for a web page. If you create a form
that uses the POST method, the data submitted by the form is passed to the server. Before you begin, make sure you
pass a form parameter to the server.
About session variables
Session variables let you 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.
Because session variables last throughout the user’s session and persist when the user moves from page to page within
the website, they’re ideal for storing user preferences. Session variables can also be used for inserting a value in the
page’s HTML code, assigning a value to a local variable, or providing a value to evaluate a conditional expression.
Before defining session variables for a page, you must create them in the source code. 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.
How session variables work
Session variables store information (usually form or URL parameters submitted by users) and make it available to all
of a web 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 by terminating the user’s session if the account remains inactive for a certain period of time. This also frees
server memory and processing resources if the user forgets to log off a website.
Session variables store information for the life of the use session. The session begins when the user opens a page within
the application and ends when the user does not open another page in the application for a certain period of time, or
when the user explicitly terminates the session (typically by clicking a “log-off ” link). While it exists, the session is
specific to an individual user, and every user has a separate session.
Use session variables to store information that every page in a web application can access. The information can be as
diverse as the user’s name, preferred font size, or a flag indicating whether the user has successfully logged in. Another
common use of session variables is to keep a running tally, such as the number of questions answered correctly so far
in an online quiz, or the products the user selected so far from an online catalog.