Project 4 - Multi-part Form Email
Overview
Simple one-page forms can be handled by readily available
form-email scripts, such as Formmail.cgi. However, if you
want to break your form into multiple pages or do any processing
on the form data, you may have to write a small script yourself.
Multi-part forms are very useful, and this project is actually
based on a job I was hired to do.
In addition, sending email from a script is one of the most
comon tasks for CGI scripts, so it's good to see how it's
done.
Preparation
Objectives
- Write an CGI script of moderate complexity
- Understand how state information is passed between multi-part
forms
Script Details
Write a perl script to collect information about users to
your website. The HTML form will be broken into two parts,
and the information gathered on the second part will depend
on the user's occupational status.
- Display an HTML form requesting the following information
from your site visitor: name, email address, location, and
occupational status (employed, unemployed, student). All
fields are required.
- The information should be submitted to the script and
a second HTML form should be displayed, collecting the following
data based on the occupational status:
- For employed persons: their occupation and employer
- For unemployed persons: their desired field of work
- For students: their school and field of study
- Upon submission, the results from both forms should be
compiled and displayed for the user. (Note: the original
intention of the project was to have the script email the
information to someone. However, the ACC servers do not
support the sendmail feature so we are instead printing
the information to the browser. If you have access to another
server, you may want to try using the sendmail function
also).
Demo
script
Notes
- There should be a single CGI script to accomplish this
project. If it helps you to understand the project, you
can start with a separate CGI scripts for each page of the
form, but you will need to combine them into a single script
before submiting your work.
- All HTML forms should be generated by the CGI script.
Do not use any plain HTML pages for this project.
- You can either decode the form data yourself (refer to
Chapter 4 in the text) or use a CGI library, such as CGI.pm.
Project Submission
You should have a link to the functional script from your
main project website. Email the text of the script and the
working URL to cgi@iteachu.com
by the deadline date in the schedule.
Jump
to Forums [Project 4]
|