The cgiGetVar procedures retrieve data from a variable sent to the program through the CGI process.
The cgiGetVar procedure is available in several formats. The basic procedure is cgiGetVar() that returns the raw value from the HTML form field to the CGI program. The other variations return the value after converting it to a specific format. The variations of the cgiGetVarxxxx procedure are as follows:
The HTML form data is automatically made available to the CGI program .
cgi-var-value cgiGetVar( szVariable 256A Const Varying nOccur 10I 0 Const OPTIONS(*NOPASS) ) |
|
See also: CleanNum, cgiGetVarCnt, cgiInit |
If the function succeeds, the return value is a text or numeric value (depending on which variation of this procedure is used) containing the data from the field in the HTML form.
If the function fails, no value is returned. Typically the function will fail if the value specified for the szVariable parameter is incorrect or is not included on the HTML form. One way to check the results is to verify that a value is returned, and if one is not returned verify the upper/lower case of the szVariable parameter with that of the form field name.
Call cgiInit once for each invocation of your CGI program, then use the cgiGetVar procedures to return the values from the HTML form.
.....DName+++++++++++EUDS.......Length+TDc.Functions+++++++++++++++++++++++++
D CONTACT S 20A
D CMPNAME S 30A
D PHONE S 11P 0
.....C..n01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++
C callp cgiInit()
C eval CONTACT = cgiGetVar('CONTACT')
C eval CMPNAME = cgiGetVar('COMPANY')
C eval PHONE = cgiGetVarI('PHONE')
Note that under OS/400 Version 4, empty parentheses are not permitted following a procedure name; under OS/400 Version 5.1 and later, empty parentheses are permitted and strongly suggested.