COP3832, Assignment 5
Due Wednesday 11/22 at the start of class
You are to write a script for me. Add a link to your server page to the script.
Hand in a printout of the script, and upload the source of your script.
Do not use CGI.pm for this assignment.
You may use the parse-lib.pl file which contains a function named
get_query. To access this, include the following statements in your
scripts
require '/home/scsfac/downeyt/scripts/parse-lib.pl';
%query = get_query();
After these commands. %query will be the associative array of name/value
pairs of any parameters sent to your script.
You will need to use the split function to separate the choices in
a checkbox or a multiple selection list.
Write a script that will display a form containing the following. Choose
a theme of your choice. All the input elements should relate to your theme.
-
A text box
-
A textarea
-
A group of three radio buttons, all with the same name and different values.
-
A group of four check boxes, all with the same name and different values.
-
A selection list of several options, only one option may be selected
-
A selection list of serveral options, many of the options may be selected.
-
A submit button
-
A reset button
When the form is submitted:
-
Verify that the text box is not blank, that at least one of the check boxes
has been selected, and that at least one of the options from the multiple
selection list is chosen. If not, then redisplay the above form with a message
indicating which fields are missing. Be sure that the user's previous choices
do not have to be reentered by the user.
-
If all the data is present, then
-
Display a new page with all the user's choices listed in a well-formatted
text display. Do not display the data using form elements,
just display them as plain text (a table would be nice).
-
Add a form to the page with three buttons:
-
Add. When pressed, append the user's data to a file of your choice, redisplay
the current page. Add the data in a nice format so that it will be easy to
interpret the file when it is displayed.
-
View. When pressed, display all the contents of the file at the bottom of
the current page. Use a preformatted tag so that the contents of the file
are displayed the way they are sotred. <PRE> and </PRE> are the
tags for preformatted text. (Redisplay the current page with the file's contents
at the bottom.)
-
Edit. When pressed, redisplay the original form. Be sure that the user's
previous choices do not have to be reentered by the user.
-
You will need a hidden element to remember what the user's data is in order
to redisplay it.
-
Extra Credit: When a user has missing data, only redisplay the form elements
that need to be filled in. Your script must still remember the elements that
were filled in. Hidden fields????