May 1996
Volume 1, Issue 2
Writing CGI Scripts in REXX Listing Eight /* PrintVariables Nicely formats the Form variables in the input string (which are in the format key1=value1&key2=value2&...) and returns them in a nicely formatted HTML string. Example: SAY PrintVariables(GETENV('QUERY_STRING')) */ PrintVariables: PROCEDURE; PARSE ARG In n='0A'X; /*Newline*/; Out=n||''||n In=TRANSLATE(In,' ','+') DO I=1 BY 1 UNTIL In='' /* Split into key and value */ PARSE VAR In Key.I'='Val.I'&' In /* Convert %XX from hex to alphanumeric*/ Key.I=DeWeb(Key.I); Val.I=DeWeb(Val.I) Out=Out''Key.I''n, ''Val.I''n END I RETURN Out||''||n ( back )
Writing CGI Scripts in REXX
Listing Eight /* PrintVariables Nicely formats the Form variables in the input string (which are in the format key1=value1&key2=value2&...) and returns them in a nicely formatted HTML string. Example: SAY PrintVariables(GETENV('QUERY_STRING')) */ PrintVariables: PROCEDURE; PARSE ARG In n='0A'X; /*Newline*/; Out=n||'
Listing Eight
/* PrintVariables
Nicely formats the Form variables in the input
string (which are in the format
key1=value1&key2=value2&...) and returns them
in a nicely formatted HTML string.
Example:
SAY PrintVariables(GETENV('QUERY_STRING'))
*/
PrintVariables: PROCEDURE; PARSE ARG In
n='0A'X; /*Newline*/; Out=n||'
In=TRANSLATE(In,' ','+')
DO I=1 BY 1 UNTIL In=''
/* Split into key and value */
PARSE VAR In Key.I'='Val.I'&' In
/* Convert %XX from hex to alphanumeric*/
Key.I=DeWeb(Key.I); Val.I=DeWeb(Val.I)
Out=Out'
'
END I
RETURN Out||'
( back )
Copyright Web Techniques. All rights reserved.