Assigment-3

 

 

 

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 ]

  1. 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 class page, please go to the form in Assignment 0 again, and fill in just the fields with your name, SSN, and class page URL.

  2. 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. Also, if you bought the WebMaster book, it discusses form tags in Chapter 10 on page 79.

    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)
      Find (find an existing employee record)
      Clear (clear the input form)

  3. 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 writes the input data to a file when (one of) the submit buttons is pressed, this is the "Add" button in our example.
    Then another Perl script that reads data from the file. If you followed our example, this would be set up as a search from the "Find" button. Or you may have picked an example in which users could print all the data in the file.
    You may use the example scripts register.pl and database.pl as models. As a matter of fact, you may make copy of these programs, install them in your Web directory, and modify them to suit your needs. If you use these example scripts, the main requirement is that you must use a different file format. You can even use the simplest format with one input record per line.

    You may use either the "ReadParse" subroutine or the CGI.pm libraries in your program.