
.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>quisp: getting cgi user variables and cookies</title>
<body bgcolor=99cc99 vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td align=right><a href="quisp_home.html">
<img src="img/quisp2.gif" border=0><br><small>quick server pages</a> &nbsp; &nbsp; </td></tr>
<td>
.>>

.TH getting cgi user variables and cookies TDH "12-APR-2004   TDH scg@jax.org" 

.SH Getting CGI user variables and cookies
The following directives get incoming
CGI user variables and cookies and make them available as 
.ig >>
<a href="variables.html">
.>>
\0QUISP variables.
.ig >>
</a>
.>>
This is usually done at the top of the page, and must be done before the variable contents can be displayed or referenced.
In all cases, if a named CGI user variable or cookie is not present,
the variable is set to a zero-length string (\fC""\fR); if desired, the
.ig >>
<a href="set.html">
.>>
\0#setifnotgiven
.ig >>
</a>
.>>
directive may be used subsequently to set these to a default value.

.ig >>
<br><br><br>
.>>

.SH #cgivar
Gets one or more ordinary CGI user variables.  
.LP
Usage: \fC#cgivar \fIvarname1\fC [,] .. \fIvarnameN\fR
.LP
Example: \fC#cgivar id mode size\fR
.LP
Example: \fC#cgivar id, mode, size\fR
.LP
Note: a directive called \fC#sqlcgivars\fR is also available.. it captures a CGI user 
variable for each field in a database table.. it is described 
.ig >>
<a href="sql.html">
.>>
\0here.
.ig >>
</a>
.>>

.ig >>
<br><br><br>
.>>

.SH #cgilistvar
Gets user variable(s) resulting from of submitted CGI form \fC<SELECT MULTIPLE>\fR responses,
representing the result as a 
.ig >>
<a href="commalist.html">
.>>
\0comma-delimited list
.ig >>
</a>
.>>
of the selected \fCVALUE\fRs.  
.LP
\fC#cgilistvar\fR should also be used to capture previously converted comma-delimited 
lists that have been \fC#pass\fR'ed.
.LP
Usage: \fC#cgilistvar  \fIvarname1\fC [,] .. \fIvarnameN\fR
.LP
Example: \fC#cgilistvar  categories\fR

.ig >>
<br><br><br>
.>>

.SH #cgimultivar
Gets one or more user variables that are the result of CGI form \fC<SELECT MULTIPLE>\fR box(es),
where the result is not to be represented as a comma-delimited list.
Variables imported this way can be used with
.ig >>
<a href="loops.html">
.>>
\0#for .. across ..
.ig >>
</a>
.>>
to do things like saving multiple responses as individual rows, without the list length restrictions.
.LP
Example: \fC#cgimultivar  categories\fR

.ig >>
<br><br><br>
.>>

.SH #cgitextvar
Gets one or more user variables that are the result of CGI form \fC<TEXTAREA>\fR.
Variables imported this way can be used with the
.ig >>
<a href="textarea.html">
.>>
\0#savetext or #showtext
.ig >>
</a>
.>>
directives.
.LP
Example: \fC#cgitextvar comments, routing_notes\fR

.ig >>
<br><br><br>
.>>

.ig >>
<a name=cookie></a>
.>>

.SH #cookie
Gets the contents of one or more
.ig >>
<a href="http://home.netscape.com/newsref/std/cookie_spec.html">
.>>
\0HTTP cookies.
.ig >>
</a>
.>>
Cookie content is truncated to 250 characters.
Cookie name should be less than 40 characters.
No character escaping or translation is done with cookie name or contents.
.LP
Cookies are useful for storing user-specific information and preferences.
However, there are limitations: they are easily viewed and modified by users,
and if a user turns off cookies or uses a different computer or browser
expected cookies may not be present.  
.LP
Usage: \fC#cookie   \fIcookiename1\fR .. \fIcookienameN\fR
.LP
Example: \fC #cookie  SESS_ID\fR
.LP 
\fBTo set a cookie\fR add an 
.ig >>
<a href="http://home.netscape.com/newsref/std/cookie_spec.html">
.>>
\0HTTP Set-Cookie statement
.ig >>
</a>
.>>
as the \fBfirst\fR output line of your template page.
No content or whitespace is permitted to precede the word \fCSet-Cookie\fR.
Example:
.LP
.nf
.ig >>
<small>
.>>
\0#cookie SESS_ID
\0#if @SESS_ID = ""
\0  #+ Set-Cookie: SESS_ID=0099; path=/cgi-bin; expires=Friday, 31 Dec 2010 10:10:10 GMT
\0#endif
.ig >>
</small>
.>>
.fi

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="quisp_home.html">
<img src="img/quisp2.gif" border=0></a><br>
<small>quick server pages &nbsp; &nbsp;<br>
<a href="Copyright.html">Copyright Steve Grubb</a> &nbsp; &nbsp;
</td></tr>
</table>
.>>
