You are viewing Revision 2 of APIs_GetParam

This page is registered as a special page, however you are viewing a previous revision of the page. As such, the special page function will not be triggered.

Subroutine Name

GetParam

Explanation and Usage

GetParam retrieves a parameter from the script. This could be either a CGI environment variable, a script variable, a field from a submitted form, etc.

Syntax

GetParam(Name, Default);

Options

Name - This is the name of the parameter you want to get. This will retrieve any of the CGI environment variables, as well as any script actions. The do action tells you what the script is trying to do (posting, revision, history, etc). page will return the name of the current page.

Default - This is the value to return if the parameter is not set. This is entirely optional, however by default GetParam will return 0 if the parameter is not set. If you need anything else, be sure to call GetParam with a default value defined.

Examples

These are actual examples from the Aneuch source code:

my $action = GetParam('doing');
Here, the variable $action is set to the value of the doing parameter. If doing is not set, then $action will be 0 (since no default is defined).