Assignment-3a

 

 

 

Foreword

Resources

Code Listings

Foil Sets

Assignments

Solutions

External Resources

SiteMap

Search

Home

 

Up ] Assignment-0 ] Assignment-1 ] Assigment-2 ] Assigment-3 ] [ Assignment-3a ] Assignment-3b ]

 

Design your class web page

Every student is required to have a web page for this course. The goal is for you to have a place where you can post your homework assignments. You can use your existing web page as long as there is a clearly marked link to your homework page.

When you have decided on what to use for your homework page, please go to the "URL Registration and Grades" link on the class web page and (after several links as usual), type in your student access code and click on personal record update. Then type in the URL of your homework page in the last field.

Design an HTML form

An HTML form consists of various form elements (or controls) such as text fields, checkboxes, radio buttons, and so forth.

You are to design an input form with a wide variety of form elements (be sure to use either checkboxes or radio buttons and to use either menus or lists along with various textfields, etc.) This form will be used in the next part of the homework assignment to write a CGI script. You may design your form about any topic that interests you. If you don't have a good idea, then you can do the employee data form below. Also, check the form below to make sure you understand how to do all the elements it discusses.

Note that in addition to the example above, there is a good tutorial specifically on forms on the HTML Resouces Page.

One idea is to design an input form that accesses an employee database:

  1. Incorporate the following data-entry fields:
    first name
    middle name
    last name
    social security number
    department
    street address
    city
    state
    zip code
  2. Restrict the zip code to five characters.
  3. Use a pop-up menu to select the state. (Hint: You'll find a ready-made HTML form element for this purpose at URL
    http://www.whowhere.com/          which you can "borrow".)  Designate "New York" as the default state.        
  4. For the department field, make a set of radio buttons with a few department names to choose from.
  5. Provide buttons for the following actions:
    Add (add a new employee record)
    Clear (clear the input form)

Write CGI scripts in Perl

In this part of the homework, we will write CGI scripts that process the input form created above.

Write a Perl script that

Emails the input data to you when the submit button is pressed.
Appends the input data to a file.
Sends a response HTML page to the user.

You may use the example scripts mailform.pl and register.pl as models. As a matter of fact, you may make copy of these programs, install them in your Web directory, and modify and combine them as necessary.

This is a change! Note that you should NOT append the entire email message to the file as mailform.pl does. You should only append the form field names and values. You *may* use the <record> tag format for the file. Be sure to describe your file format in the description of your solution to the problem, as stated below.

Note that when you write or append to a file with a CGI script, our CGI directories are set up to most easily do that by keeping the file in the CGI directory. Your CGI directory must have at least "group access", but not world access, (and under no circumstances you change the group on this directory!) and the file must have "world write permission". In this way, when the web server executes the cgi script, it can enter the directory as the group and then it can write the file as the world.

You may use either the "ReadParse" subroutine or the CGI.pm libraries in your program. If you use ReadParse, you must also copy ReadParse.pl to your cgi directory.

When you submit your homework, make a link on your homework page to a page for homework 1 which includes:

A short description of your solution
Links to nicely documented HTML files and Perl programs (note that the Perl program must be moved to a web docs directory because it won't display from a web cgi directory).
Links to your output file.