CGI Programming
Structure of Program Using POST Method
- The HTML Form is sent to the client. This Form includes all the
named fields that the user will click, select, pull down, or type in the
answers. The Form tag also contains the Method (in this case Post) and
the Action (which is the URL to which all the input parameters are sent).
In the case of the AS/400, this URL is your CGI application that runs
in QSYS.LIB.
- The user selects the Submit button. The HTTP server routes the
data to the CGI program, which places the named variables and values
in Stdin. It then calls your CGI application which can do:
- Call QtmhRdStin, which places the entire input string read from
stdin into a receiver variable of type pointer to character.
- Call QtmhCvtDb, which parses the string of named variables and values
and places all the data into a database file formatted by DDS.
- Processing...anything that you could want to do including access to
DB2/400 data.
- Most likely either during or as the result of the processing your
CGI application will have to generate the HTML output that will be going
back to the client. This could be as complex as a multi-page table with
imbedded hypertext links, or a pre-formatted HTML page that says "Thank you
for your order".
- Call QtmhWrStout to write the HTML to standard out (stdout).
- When your application ends, whatever you wrote to stdout will be sent
back to the Web client.
Agenda
CGP050