Lab Exercise 3
CMPUT 410 (Winter 2004)
Due Date: Week 5 before the end of your lab time.
Objectives: Use CGI programming to validate input on HTML forms.
Comments: Your TA has to see that the exercise is done.
In the previous exercise you saw how Javascript can validate HTML form
input before entered data is submitted to the server.
Another option would be to send the data as it is entered as soon as
the form is submitted and let the program on the server, a CGI or a
servlet, validate the data. If the data is not correct, the program on
the server has to reproduce the form and warn the user about the
incorrect field. All entered fields should be preserved.
Reproduce the HTML code to render the simple HTML form as in Figure 1.
Identical to L:ab Exercise 2, this form comprises some fields that are optional and others that are
mandatory. Mandatory fields are marked with an asterisk.
All fields are text fields except the Province
Write a CGI program, either with C/C++ or Perl, to receive
the submitted data and validate the form input.
If any of the mandatory fields are missing or either the postal code
or e-mail is incorrect, the form should re-produced with all entered
fields in addition to a message in red indicating the problem.
If the submitted data is correct, the CGI should generate a page
summarizing the entered data in a simple table.

Figure 1
|