I am working on a .cgi script to send form data when someone completes an evaluation after we complete a project.
I copied this from another cgi script we have on our site that does work.
When I try to run this script I get 500 Internal Server error, checking the logs I find this error:
Premature end of script headers: /home/system2/public_html/cgi-bin/eval.cgi
I have scoured the script and cannot find where the problem.
Could someone see if they could find the error?
Here is the cgi script:
Code:
#!/usr/local/bin/perl
#
# script to process Customer Service Evaluation form for Systemsnspace.com
# authored by Matt Leotta
#
#
$returnpage = "www.systemsnspace.com/index.html";
require "cgi-lib.pl";
#
# read in the output into an associative array
#
&ReadParse(*in);
# required fields.
$custname = $in{"name"};
$custcompany = $in{"company"};
$custprojectid = $in{"projectid"};
$1_1 = $in{"11"};
$1_2 = $in{"12"};
$1_3 = $in{"13"};
$1_4 = $in{"14"};
$2_1 = $in{"21"};
$2_2 = $in{"22"};
$2_3 = $in{"23"};
$3_1 = $in{"31"};
$3_2 = $in{"32"};
$3_3 = $in{"33"};
$3_4 = $in{"34"};
$4_1 = $in{"41"};
$4_2 = $in{"42"};
$4_3 = $in{"43"};
$5_1 = $in{"51"};
$ans_busagain = $in{"dobusagain"};
$ans_recommend = $in{"recommend"};
$ans_whybuyssi = $in{"whybuyssi"};
$ans_referrals = $in{"referrals"};
$ans_comments = $in{"comments"};
if ($custname eq "" || $custcompany eq "" || $custprojectid eq "" || $1_1 eq "" || $1_2 eq "" || $1_3 eq "" || $1_4 eq "" || $2_1 eq "" || $2_2 eq "" || $2_3 eq "" || $3_1 eq "" || $3_2 eq "" || $3_3 eq "" || $3_4 eq "" || $4_1 eq "" || $4_2 eq "" || $4_3 eq "" || $5_1 eq "" || $ans_busagain eq "" || $ans_recommend eq "" || $ans_whybuyssi eq "" || $ans_referrals eq "" || $ans_comments eq "") {
$error2 = "missing info";
}
if ($error2 ne "missing info" ) {
# ------------------------------------------------------------
#
# Send mail to ssi
#
$sendTo = "$in{email}";
open(SM, "| /usr/sbin/sendmail $sendTo") || die;
print(SM "From: $in{name} <$in{from_email}>\n".
"To: $in{recipient} <$in{email}>\n".
"Subject: $in{subject}\n\n");
print SM Customer Service Evaluation,"\n";
print SM "======================================\n";
print SM "CONTACT INFORMATION\n";
print SM "Name: ",$in{"name"},"\n";
print SM "Company: ",$in{"company"},"\n";
print SM "Project #: ",$in{"projectid"},"\n";
print SM "--------------------------------------\n";
print SM "PLANNING\n";
print SM "Professional & Polite.................: ",$in{"11"},"\n";
print SM "Knowledgeable & Helpful...............: ",$in{"12"},"\n";
print SM "Met Functional & Creative Expectations: ",$in{"13"},"\n";
print SM "Responsive & Timely...................: ",$in{"14"},"\n";
print SM "--------------------------------------\n";
print SM "COORDINATION\n";
print SM "Professional & Polite.................: ",$in{"21"},"\n";
print SM "Well Communicated.........................: ",$in{"22"},"\n";
print SM "Met Project Timeline......................: ",$in{"23"},"\n";
print SM "--------------------------------------\n";
print SM "INSTALLATION\n";
print SM "Professional & Polite.................: ",$in{"31"},"\n";
print SM "Knowledgeable & Helpful...............: ",$in{"32"},"\n";
print SM "On-time Arrival...........................: ",$in{"33"},"\n";
print SM "Complete & Accurate...................: ",$in{"34"},"\n";
print SM "--------------------------------------\n";
print SM "PRODUCT\n";
print SM "Qyality...................................: ",$in{"41"},"\n";
print SM "Functionality.............................: ",$in{"42"},"\n";
print SM "Design & Appearance...................: ",$in{"43"},"\n";
print SM "--------------------------------------\n";
print SM "COMPANY\n";
print SM "Overall Performance.......................: ",$in{"51"},"\n";
print SM "--------------------------------------\n";
print SM "Do business again.........................: ",$in{"dobusagain"},"\n";
print SM "--------------------------------------\n";
print SM "Recommend.................................: ",$in{"recommend"},"\n";
print SM "--------------------------------------\n";
print SM "Why bought from SSI..: ",$in{"whybuyssi"},"\n";
print SM "--------------------------------------\n";
print SM "Referrals............: ",$in{"referral"},"\n";
print SM "--------------------------------------\n";
print SM "Comments.............: ",$in{"dobusagain"},"\n";
print SM "--------------------------------------\n";
print SM "\n.\n";
close(SM);
print &PrintHeader;
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Systems and Space, Inc. -- Customer Service Evaluation</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "\n";
print "<center>\n";
print "<h3>\n";
print "<font face=arial>Completed Evaluation</font>\n";
print "</h3>\n";
print "Thank you ",$in{"name"}, " for taking the time to complete this evaluation!<BR>\n";
print "We appreciate your feedback, and your business.\n";
print "<P>\n";
print "<A HREF=\"http://www.systemsnspace.com/index.html\" target=\"_top\">Return to Home Page</A>\n";
print "</CENTER>\n";
print "</BODY>\n";
print "</HTML>\n";
}
else {
print &PrintHeader;
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Missing Information</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "\n";
print "<table width=100%>\n";
print "<tr>\n";
print "<td bgcolor=FF0909 align=center><font color=FFFFFF face=arial size=4><B>";
print "Error - Missing Information<BR>";
print "<B></font></td>\n";
print "</tr>\n";
print "</table>\n";
print "<p>\n";
print "<p>\n";
print "<B>Missing Information:</B> Your form is missing some required information.\n";
print "<BR>\n";
if ( $custname eq "" ) {
print "<DD>Customer Name - Missing\n";
print "<BR>\n";
}
if ( $custcompany eq "" ) {
print "<DD>Company/Organization - Missing\n";
print "<BR>\n";
}
if ( $custprojectid eq "" ) {
print "<DD>Project # - Missing\n";
print "<BR>\n";
}
if ( $1_1 "" ) {
print "<DD>Planning - Professional & Polite - Please rate\n";
print "<BR>\n";
}
if ( $1_2 eq "" ) {
print "<DD>Planning - Knowledgeable & Helpful - Please rate\n";
print "<BR>\n";
}
if ( $1_3 eq "" ) {
print "<DD>Planning - Met Functional & Creative Expectations - Please rate\n";
print "<BR>\n";
}
if ( $1_4 eq "" ) {
print "<DD>Planning - Responsive & Timely - Please rate\n";
print "<BR>\n";
}
if ( $2_1 eq "" ) {
print "<DD>Coordination - Professional & Polite - Please rate\n";
print "<BR>\n";
}
if ( $2_2 eq "" ) {
print "<DD>Coordination - Well Communicated - Please rate\n";
print "<BR>\n";
}
if ( $2_3 eq "" ) {
print "<DD>Coordination - Met Project Deadline - Please rate\n";
print "<BR>\n";
}
if ( $3_1 eq "" ) {
print "<DD>Installation - Professional & Polite - Please rate\n";
print "<BR>\n";
}
if ( $3_2 eq "" ) {
print "<DD>Installation - Knowledgeable & Helpful - Please rate\n";
print "<BR>\n";
}
if ( $3_1 eq "" ) {
print "<DD>Installation - On-time Arrival - Please rate\n";
print "<BR>\n";
}
if ( $3_1 eq "" ) {
print "<DD>Installation - Complete & Accurate - Please rate\n";
print "<BR>\n";
}
if ( $4_1 eq "" ) {
print "<DD>Product - Quality - Please rate\n";
print "<BR>\n";
}
if ( $4_2 eq "" ) {
print "<DD>Product - Functionality - Please rate\n";
print "<BR>\n";
}
if ( $4_3 eq "" ) {
print "<DD>Product - Design & Appearance - Please rate\n";
print "<BR>\n";
}
if ( $5_1 eq "" ) {
print "<DD>Company - Overall Performance - Please rate\n";
print "<BR>\n";
}
if ( $ans_busagain eq "" ) {
print "<DD>Would you do business with us again? - Please answer\n";
print "<BR>\n";
}
if ( $ans_recommend eq "" ) {
print "<DD>Would you recommend us to other business associates? - Please answer\n";
print "<BR>\n";
}
if ( $ans_whybuyssi eq "" ) {
print "<DD>Why did you buy from SSI? - Please answer\n";
print "<BR>\n";
}
if ( $ans_referral eq "" ) {
print "<DD>What other departments need improved storage solutions? - Please answer\n";
print "<BR>\n";
}
if ( $ans_comments eq "" ) {
print "<DD>Any other comments? - Please answer\n";
print "<BR>\n";
}
print "<center>\n";
print "<br>\n";
print "<FORM>\n";
print "<FONT FACE=\"arial\" size=2>Please press <input type=button value=\" < Back \" onClick=\"history.back();\"> or the [ BACK ] button on your browser to re-enter the information.</FONT>\n";
print "</FORM>\n";
print "<p>\n";
print "</BODY>\n";
print "</HTML>\n";
}
Thanks!