#set TITLE = "getting cgi user variables and cookies"

#include top

.SH Getting CGI user variables and cookies
The following directives get incoming
CGI user variables and cookies and make them available as 
#set FILE = "variables.html"
#set TAG = "QUISP variables."
#include link
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
#set FILE = "set.html"
#set TAG = "#setifnotgiven"
#include link
directive may be used subsequently to set these to a default value.

#include space

.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 
#set FILE = "sql.html"
#set TAG = "here."
#include link

#include space

.SH #cgilistvar
Gets user variable(s) resulting from of submitted CGI form \fC<SELECT MULTIPLE>\fR responses,
representing the result as a 
#set FILE = "commalist.html"
#set TAG = "comma-delimited list"
#include link
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

#include space

.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
#set FILE = "loops.html"
#set TAG = "#for .. across .."
#include link
to do things like saving multiple responses as individual rows, without the list length restrictions.
.LP
Example: \fC#cgimultivar  categories\fR

#include space

.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
#set FILE = "textarea.html"
#set TAG = "#savetext or #showtext"
#include link
directives.
.LP
Example: \fC#cgitextvar comments, routing_notes\fR

#include space

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

.SH #cookie
Gets the contents of one or more
#set FILE = "http://home.netscape.com/newsref/std/cookie_spec.html
#set TAG = "HTTP cookies."
#include link
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 
#set FILE = "http://home.netscape.com/newsref/std/cookie_spec.html"
#set TAG = "HTTP Set-Cookie statement"
#include link
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

#include bottom
