
Generic ScriptThe most common use of a CGI script on the Web is to process data submitted through a form. The Web browser transmits this data in name/value pairs. The author of the form defines the name of each form element. The CGI script, generic.cgi, was written to help Web publishers check the name/value pairs created by fill-out forms. Begin a Web form with <FORM ACTION="http://www.utexas.edu/teamweb/cgi-bin/generic.cgi" METHOD="POST"> and the script will return a Web page to your browser which contains the name of each element of your Web form which is returned by the browser followed by an equals sign and the value of that element. Most Web browsers do not return any values for checkboxes, radio buttons, or select menu items, which are not selected.
Sample Form Processed by generic.cgiThe HTML source of the form
The form as it appears in the browserThe Web page returned by generic.cginame = WebMaster The response from the CGI script has only one line, since Web browsers only submit information for checkboxes if the checkbox is selected. If the checkbox is selected, the response from the script will have two lines. To see how this works, try changing the values in the form above, and click the "Submit Query" button. You will need to use your browser's "back" feature to return to this page. |