|> Home > Documentation > Latest documentation > Interchange tags > cgi|
Returns the the current value of the named CGI input variable. Can also set a new CGI value within the current page.
Tag expansion example
Assuming the value of the CGI variable "foo" is "bar":
or similarly with positional parameters:
Returns the the current value of the named CGI input variable submitted to the current page. This is similar to [value], except it displays the transitory values that have been submitted with the current request.
When the value is returned, any Interchange and HTML tags present in the value will be escaped. This prevents users from entering Interchange tags into form fields, which could be a serious security risk. It also helps prevent HTML injection attacks.
You can also set a new CGI value within the current page.
For instance, if you access the following URI:
then, on the pagename.html page, [cgi foo] will output "bar".
This is the name of the CGI variable whose value you want.
This sets a return value in case the named CGI variable is missing or otherwise false. The following will expand to "Using default":
Any "<" characters, found in the output value, will normally be converted into "<" for safety reasons. This conversion can be disabled by setting the "enable_html" parameter true.
Setting filter="filter1 filter2" modifies the named CGI variable by running it through the specified filter(s).
See the filters category for a list of standard filters.
Set keep=1 if you want the tag to return a filtered result but do not want the filter to modify the CGI value itself in the $CGI hashref.
You can change a value with set="new_value". The tag will return the CGI value you set unless you also pass the hide=1 parameter.
Note that this is only available in new-style tags, for safety reasons.
Setting hide=1 suppresses the tag's return value, which can be useful with the set attribute.