Skip to content

Instantly share code, notes, and snippets.

@covener
Created March 10, 2020 13:53
Show Gist options
  • Save covener/6d49fefd8f8b798af77b7156ab880c88 to your computer and use it in GitHub Desktop.
Save covener/6d49fefd8f8b798af77b7156ab880c88 to your computer and use it in GitHub Desktop.
/* REXX */
'cgiutils -status 200 -ct text/html'
say '<HTML>'
say '<BODY>'
say '<H1>Processing forms with CGI scripts</H1>'
say '<P>'
say 'This is an example of a CGI script which uses the <CODE>'
say 'cgiutils</CODE> and <CODE>cgiparse</CODE>'
say 'functions to create a valid HTTP header and parse forms data,'
say 'respectively.'
say 'The <CODE>cgiutils</CODE> program is used to create'
say ' a set of HTTP'
say 'headers for the CGI script output.'
say '<P>'
say 'The <CODE>cgiparse</CODE> program is used to extract'
say ' data submitted as HTTP GET or POST requests from'
say 'forms The program parses variables from the CGI QUERY_STRING'
say 'environment variable.'
say 'The <CODE>cgiparse</CODE> program is useful for'
say 'extracting information such as the value of'
say 'a specific form field or the number of unique fields submitted'
say 'from a form.'
say 'This information can then be processed by CGI scripts in'
say 'performing their intended functions.'
say '<p>'
say 'Some examples of how the <CODE>cgiparse</CODE> program'
say ' can be used are shown below'
say '<HR>'
say '<H2>Parsing forms requests using <CODE>cgiparse'
say '</CODE>'
say '</H2>'
say ''
say 'The following is an example of the output that is generated by'
say 'using the -form option of the'
say '<CODE>cgiparse</CODE> command. The -form option'
say 'will parse the QUERY_STRING as a form request'
say 'and output the fields as a string of variables.'
say '<P>'
say 'The format of the <CODE>cgiparse</CODE> command is'
say '<CODE> cgiparse -form </CODE>.'
say '<P>'
say '<CODE>'
'cgiparse -form'
say'</CODE>'
say '<HR>'
say '<H2>Querying values using <CODE>cgiparse</CODE>'
say '</H2>'
say 'The following is an example of using the <CODE>cgiparse'
say '</CODE>'
say 'command to query the values of specific'
say 'fields parsed from the QUERY_STRING.'
say '<P>'
say 'The format of the <CODE>cgiparse</CODE> command is'
say '<CODE>cgiparse -value <CITE>fieldname</CITE>'
say '</CODE>'
say '<P>'
say 'Value for variable 1 = <CODE>'
'cgiparse -value var1'
say '<BR></CODE> '
say 'Value for variable 2 = <CODE>'
'cgiparse -value var2'
say '<BR></CODE>'
say 'Value for variable 3 = <CODE>'
'cgiparse -value var3'
say '<BR></CODE>'
say 'Value for variable 4 = <CODE>'
'cgiparse -value var4'
say '<BR></CODE>'
say 'Value for variable 5 = <CODE>'
'cgiparse -value var5'
say '<BR></CODE>'
say 'Value for variable 6 = <CODE>'
'cgiparse -value var6'
say '</CODE>'
say '<P>'
say '<HR>'
say '<H2>Determining the number of fields in QUERY_STRING using'
say '<CODE>cgiparse</CODE></H2>'
say 'The <CODE>cgiparse</CODE> function can also be used to'
say 'determine the number of unique fields that are submitted with'
say 'a form.'
say '<P>'
say 'The format of the <CODE>cgiparse</CODE> command is'
say '<CODE>cgiparse -form -count</CODE>.'
say '<P>'
say 'Number of unique fields = <CODE>'
'cgiparse -form -count'
say '<BR></CODE>'
say 'As Keywords:= <CODE>'
'cgiparse -keywords'
say '<BR></CODE>'
say '<HR>'
say '</BODY>'
say '</HTML>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment