CECS 5100

Survey of Educational Computer Languages

Fall 2003


Assignment #3 (part b) - Intro CGI PERL Program that reads from a HTML Form POST and outputs the results

Due Date: October 24, 2003

Value: 5 points

Send the instructor an e-mail containing the HTML form page for this assignment. greg@tapr.org.

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.

  1. 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.
  2. 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
  1. 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:
    <h2>Assignment 3B (Your Name Here)</h2>
    <pre>Name:         Greg
    E-Mail:       wd5ivd@tapr.org
    City:         Denton
    State:        Texas
    Your average grade is: 66.2
Expected Code:
  1. Student should take the examples discussed in class and modify them to accomplish the programming assignment.
  1. 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.
  2. 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


<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>
    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">
<b>Please input all of your grades separated by spaces:</b>

<INPUT NAME="grades" TYPE="TEXT" SIZE="100">

<P><b>Thank you!</b> <INPUT TYPE="SUBMIT" value="Submit Request"> <INPUT TYPE="RESET">


Copyright 2003, Dr. James G. Jones