<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>var</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="upload.html" title="upload"><link rel="next" href="wrap.html" title="wrap"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">var</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="upload.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="wrap.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry" title="var"><div class="refentry.separator"><hr></div><a name="var"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>var, var_qs, var_post — get the value of a form variable.</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var_qs</span> (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var_post</span> (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div></div><div class="refsect1" title="Description"><a name="idp6135568"></a><h2>Description</h2><p style="width:90%"> | |
The <span style="font-family:monospace"><span class="command"><strong>var</strong></span></span> command retrieves information | |
about GET or POST variables sent to the script via client | |
request. It treats both GET and POST variables the same, | |
regardless of their origin. Note that there are two | |
additional forms of <span style="font-family:monospace"><span class="command"><strong>var</strong></span></span>: | |
<span style="font-family:monospace"><span class="command"><strong>var_qs</strong></span></span> and <span style="font-family:monospace"><span class="command"><strong>var_post</strong></span></span>. | |
These two restrict the retrieval of information to | |
parameters arriving via the querystring | |
(?foo=bar&bee=bop) or POSTing, respectively. | |
</p><div class="variablelist"><dl><dt><span class="term"> | |
<div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> <span style="font-family:monospace; font-weight: bold;">get</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>varname</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>?<span class="optional">default</span>?</code></em></span>?</div></div> | |
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"> | |
Returns the value of variable | |
<em class="replaceable"><code>varname</code></em> | |
as a string (even if there are multiple values). If | |
the variable doesn't exist as a GET or POST | |
variable, the | |
<em class="replaceable"><code>?<span class="optional">default</span>?</code></em> | |
value is returned, otherwise "" - an empty string - | |
is returned. | |
</div></div></dd><dt><span class="term"> | |
<div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> <span style="font-family:monospace; font-weight: bold;">list</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>varname</code></em></span>?</div></div> | |
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"> | |
Returns the value of variable | |
<em class="replaceable"><code>varname</code></em> as a list, | |
one list element per reference. Radiobuttons or multiple | |
selection listboxes are suited widgets which may | |
return list data. | |
</div></div></dd><dt><span class="term"> | |
<div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> <span style="font-family:monospace; font-weight: bold;">exists</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>varname</code></em></span>?</div></div> | |
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"> | |
Returns 1 if | |
<em class="replaceable"><code>varname</code></em> | |
exists, 0 if it doesn't. | |
</div></div></dd><dt><span class="term"> | |
<div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> <span style="font-family:monospace; font-weight: bold;">number</span> </div></div> | |
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"> | |
Returns the number of variables. | |
</div></div></dd><dt><span class="term"> | |
<div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span> <span style="font-family:monospace; font-weight: bold;">all</span> </div></div> | |
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"> | |
Return a list of variable names and values. | |
</div></div></dd></dl></div><p style="width:90%"> | |
See <a class="xref" href="examples.html#variable_access" title="Example 3. Variable Access">Example 3, “Variable Access”</a>. | |
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="upload.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="wrap.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">upload </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> wrap</td></tr></table></div></body></html> |