Forms Processing on the Web

Forms and forms processing is a very powerful vehicle on the Web. It allows information gathering and processing to proceed on separate machines, completely transparent to the user. It is a good way to begin distributed computing.

Linking the form to the form server

< FORM METHOD = "POST" ACTION = "http://www.csc.villanova.edu/cgi-bin/cgi-bin/form.server.name">
We will only look at METHOD = POST
(The alternative is METHOD=GET.  POST sends the information in the form to the process as standard input.  GET makes it available as an ENVIRONMENT VARIABLE.  There are advantages to each.  Standard input is good if you have a lot of input, or if the user had the option of entering very long strings.  The Environment variable is restricted in size.  On the other hand, using GET makes the query visible in the Location box of the browser and allows the user to save the query and reuse it on another occasion.).

ACTION = cgi-bin/cgi-bin/form.server.name
points to the process that will accept input from your form and perform whatever actions you have described. The process is frequently defined as a script file.

There is limited access to the area where accessible scripts and programs can be stored. A useful tool in developing and testing your scripts is
found at http://www.csc.vill.edu/cgi-bin/cgi-bin/gentest.pl
 This is  a little perl program to aid in testing your form servers.  The file just takes whatever input a form provides and writes it to a file
called /tmp/testscript on Renoir

The downside of this approach is that each of you will write to the same file.  So, you need to submit your form and then immediately copy that file from the /tmp area to your own directory.  If the content looks really strange, it may be that two or more of you are testing at the same time.  Select a random number, count slowly to that number and try again. (Ethernet collision resolution.)

You can try the process out by filling in the form at http://renoir.vill.edu:80/~cassel/4900/testform.html
After you fill in the form, you will see the following message:
Form data is available as /tmp/testscript, which you can retrieve with ftp, and as /csc/a/testscript/genout, which you can copy directly.

To use the test file, use the following in your form:
<form method="post" action="http://www.csc.vill.edu/cgi-bin/cgi-bin/gentest.pl">

Since this will produce the output of your form exactly as it would go to your server program, you can use that file as input in testing your code.
 


The form server

The script that produces the file and a return message to view at your browser is /csc/a/gopherg/cgi-bin/gen.pl. Gentest creates file /tmp/testscript
[ Villanova Homepage | CSC Homepage | CSC Faculty ]
Lillian N. (Boots) Cassel

Department of Computing Sciences
Villanova University
Villanova, PA 19085-1699
+1 610 519 7341

cassel@acm.org
19 January 2000