HTML Forms and CGI Scripts

The HTML language provides commands (tags) which allows users (viewers of your page) to submit input through filling out forms, clicking input buttons, or choosing from menus. There are numerous reasons why you might want to collect information from folks that view your web page.

Implementing forms through HTML tags is easy for users with HTML experience. Collecting the input from the forms and doing something with it is not so easy. It requires knowledge of cgi programming in Perl or C. The form in on your Web page sends the user input from your Web page to a cgi program on the Web server. The cgi program will then act on that input according to the code in the program. It's possible to implement forms with limited knowledge of programming by using other's programs and personalizing them to meet your needs. Generally speaking, there are three actions to take with the information retrieved from forms:

  1. Open a specific URL which is personalized to meet the needs of the user.
  2. Email the form input to the owner of the page for interpretation.
  3. Both of the above.

To get a feeling for the HTML code behind forms check out the following sites:

http://robot0.ge.uiuc.edu/~carlosp/cs317/ft.1.html

http://kuhttp.cc.ukans.edu/info/forms/forms-intro.html

Do a keyword search on "html forms" and you'll find abundant information.


Form Examples:

Checkbox Form

Radio Button Form

Menu Form

Submit by email form(This WILL send email to baldauf@cs)


After trying out the examples, copy the .html and .cgi files to your public.html so that you can view them.

Or you can just view all the files with pico directly in ~baldauf/public_html/Internet/Forms. The file names should be self-explanatory.

After studying these files, and seeing how they operate in the browser, you should get a feel for how they work.


For Assignment 3, Change any references to "baldauf" in mailform.html and mailform.cgi to your own name. Copy the html code from mailform.html into your index.html or create a link to mailform.html from index.html so that users can provide you with feedback concerning your web page.


If interested in learning more about Perl, you might want to grab a copy of O'Reilly & Associates, "Programming Perl" for future reference. Among Perl programmers, it's the Bible. There's also a companion book called "Learning Perl" that's excellent for beginners. Check the FSU bookstore for more references.