Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
.cgi sendmail error - Premature end of script headers
Old 09-06-2007, 03:31 PM .cgi sendmail error - Premature end of script headers
DrSeuss's Avatar
Skilled Talker

Posts: 60
Name: Matt
Trades: 0
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 &amp; Polite.................: ",$in{"11"},"\n";
print SM "Knowledgeable &amp; Helpful...............: ",$in{"12"},"\n";
print SM "Met Functional &amp; Creative Expectations: ",$in{"13"},"\n";
print SM "Responsive &amp; Timely...................: ",$in{"14"},"\n";
print SM "--------------------------------------\n";
print SM "COORDINATION\n";
print SM "Professional &amp; 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 &amp; Polite.................: ",$in{"31"},"\n";
print SM "Knowledgeable &amp; Helpful...............: ",$in{"32"},"\n";
print SM "On-time Arrival...........................: ",$in{"33"},"\n";
print SM "Complete &amp; 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 &amp; 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 &amp; Polite - Please rate\n";
print "<BR>\n";
}
if ( $1_2 eq "" ) {
print "<DD>Planning - Knowledgeable &amp; Helpful - Please rate\n";
print "<BR>\n";
}
if ( $1_3 eq "" ) {
print "<DD>Planning - Met Functional &amp; Creative Expectations - Please rate\n";
print "<BR>\n";
}
if ( $1_4 eq "" ) {
print "<DD>Planning - Responsive &amp; Timely - Please rate\n";
print "<BR>\n";
}
if ( $2_1 eq "" ) {
print "<DD>Coordination - Professional &amp; 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 &amp; Polite - Please rate\n";
print "<BR>\n";
}
if ( $3_2 eq "" ) {
print "<DD>Installation - Knowledgeable &amp; 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 &amp; 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 &amp; 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!
DrSeuss is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-07-2007, 08:10 PM Re: .cgi sendmail error - Premature end of script headers
DrSeuss's Avatar
Skilled Talker

Posts: 60
Name: Matt
Trades: 0
Is there no one here that help me with this????
DrSeuss is offline
Reply With Quote
View Public Profile
 
Old 09-08-2007, 02:56 AM Re: .cgi sendmail error - Premature end of script headers
Skilled Talker

Posts: 77
Trades: 0
.cgi is not so popular anymore. . . it's all I know, but not too many people use it.

Anyway, I couldn't find a bug either, however, I got a different error than you did when I ran this locally I added carp:fatalstobrowser:

syntax error at D:/web/htdocs/test.cgi line 25, near "$1_1 "

which line 25 for me is $1_1 = $in{"11"};

Maybe that'll help some. . .
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Last edited by whooligan; 09-08-2007 at 02:56 AM.. Reason: horrible grammar. . . sleepy
whooligan is offline
Reply With Quote
View Public Profile
 
Old 09-09-2007, 06:45 AM Re: .cgi sendmail error - Premature end of script headers
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you could try some dedicated Perl forums;

http://www.tek-tips.com/threadminder.cfm?pid=219
http://www.codingforums.com/forumdisplay.php?f=5

and Matt over at Elated is a Perl programmer
http://www.elated.com/cgi-bin/teemz/...nd_Programming
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-10-2007, 03:26 PM Re: .cgi sendmail error - Premature end of script headers
DrSeuss's Avatar
Skilled Talker

Posts: 60
Name: Matt
Trades: 0
Problem solved! Thanks a lot guys

Using thew carp:fatalbroswer: code showed me some silly syntax errors, and now it is all good
DrSeuss is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to .cgi sendmail error - Premature end of script headers
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40387 seconds with 12 queries