Assignments
Assignment #3 (part b) - Intro CGI PERL Program that reads from a HTML Form POST and outputs the results
Due Date: October 24, 2002
Value: 5 points
Submission:
Send the instructor an e-mail containing the HTML form page for this assignment. greg@tapr.org.
Assignment:
Using PERL create a .cgi that will read in information from the HTML based form provided below and displays the information submitted and then averages and displays the supplied grades.
- Upon viewing the HTML form (below) stored in your public_html folder on your UNIX account, the user will fill-out and then submit the form.
- The HTML form calls assign3b.cgi which should be stored in your cgi-bin account on your UNIX account and when run displays the information provided along with the average of the grades submitted in the form.
Test Data:
Name is Greg Jones
Email Address is gjones@coefs.coe.unt.edu
City is Denton
State is Texas
Grades are 33 44 55 100 99
Output:
- Upon receiving the information from the form via the POST method, display the information from the form along with calculating the average of the supplied grades. The output should look something like:
<html><body>
<h2>Assignment 3B (Your Name Here)</h2>
<pre>Name: Greg
E-Mail: wd5ivd@tapr.org
City: Denton
State: Texas
</pre>
<hr>
<p>
Your average grade is: 66.2
<p>
</body></html>
Expected Code:
- Student should take the examples discussed in class and modify them to accomplish the programming assignment.
Note:
- You will need to use a split command to separate the grades into an hash that you can then add together while counting the number of grades to get the average.
- The syntax to do this is the same as getting the pairs from the information sent by the form from the POST
HTML Form to use
<html>
<body>
<h2>Assignment 3b (Your Name Here)</h2>
<form action="http://saturn.cecs.unt.edu/cgi-bin/gjones/assign3b.cgi" method="POST">
<P><b>Please enter the following information:</b>
<pre>
Name: <INPUT NAME="name" TYPE="TEXT" SIZE="40">
E-mail address: <input type="text" name="email" SIZE="40">
City: <INPUT NAME="city" TYPE="TEXT" SIZE="40">
State: <INPUT NAME="state" TYPE="TEXT" SIZE="40">
</pre>
<P>
<b>Please input all of your grades separated by spaces:</b>
<INPUT NAME="grades" TYPE="TEXT" SIZE="100">
<p>
<P><b>Thank you!</b> <INPUT TYPE="SUBMIT" value="Submit Request"> <INPUT TYPE="RESET">
</FORM>
</body>
</html>
Copyright 2002, Dr. James G. Jones
|