HI,
I'm having difficulties using the CGI module, I've read over the module but it's not
sinking in.
Any help would be greatly appreciated -- Pam
the html form can be seen at:
www.unex.berkeley.edu/test2/av_form.html
the output of the form is sent to a file and also emailed
the problems I'm having are:
1. Error checking
For example:
if a user checks on "35mm Slide Projector"
and does NOT give the "Dates Needed"
I want an error message displayed saying:
"Dates needed for 35mm Slide Projector
Here's how I defined the checkboxes
$av_equip = $q -> param('av_equip'
-name=>'av_equip',
-values=>[slide,tvvcr,lcd,boombox,overhead,opaque,flipchart,projection]
);
Here's the error checking logic:
# Error checking
if ($coursetitle eq "") {
# A form field is missing data; return an error
print $q -> h3(), "You must enter the course title.";
}
elsif ($instructor eq "") {
# A form field is missing data; return an error
print $q -> h3(), "You must enter your name.";
}
elsif ($edp eq "") {
# A form field is missing data; return an error
print $q -> h3(), "You must enter the course edp number.";
}
elsif ($av_equip eq "slide" || "tvvcr" || "lcd" || "boombox" || "overhead" || "opaque"
|| "flipchart" || "projection") {
if ($date_slide eq "") {
print $q -> h3(), "Please enter dates needed for 35mm slide
projector.";
}
if ($date_tvvcr eq "") {
print $q -> h3(), "Please enter dates needed for TV/VCR combo.";
}
}
2. An email will be sent from the drop down menu, but it's not working
the html code is:
<tr>
<td width=100 bgcolor="#FFCC66"><b>Extension Representative: </b></td>
<td width=375 align="left">
<SELECT NAME="send_to">
<OPTION VALUE="">Click and pulldown menu</OPTION>
<OPTION VALUE="[EMAIL PROTECTED]">Pam Smith</OPTION>
<OPTION VALUE="[EMAIL PROTECTED]">Sue Jones</OPTION>
</SELECT>
snippet of cgi code is:
$tempfile = "/tmp/avtemp$$.txt";
$send_to = $q -> param('send_to');
# E-mail answers:
$date = localtime();
if (open(MAIL, ">$tempfile")) {
print MAIL <<EOF;
To: $send_to
From: $send_to
Subject: AV Request Form
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]