![]() |
| > Home > Documentation > Latest documentation > Interchange tags > cgi |
|
cgiReturns the the current value of the named CGI input variable. Can also set a new CGI value within the current page. Summary
ExamplesTag expansion exampleAssuming the value of the CGI variable "foo" is "bar":
Perl example
or similarly with positional parameters:
The following lookup from the $CGI hash reference is more efficient than calling $Tag->cgi(), and yields the same result:
DescriptionReturns 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 same as $CGI->{foo} in embedded Perl. ParametersnameThis is the name of the CGI variable whose value you want. defaultThis sets a return value in case the named CGI variable is missing or otherwise false. The following will expand to "Using default":
enable_htmlAny "<" 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. filterSetting 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. keepSet 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. setYou 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. hideSetting hide=1 suppresses the tag's return value, which can be useful with the set attribute.
DonationsPlease contact us if you have a HOWTO-style document, or anything else you'd like to share with other Interchange users and developers. Go on - you know you want to. |
| Home | Legal nonsense | Privacy policy | Contact us |