Premature end of script headers

W

Wayne Deleersnyder

Hi,

I'm a newbie at Perl and CGI and hoping someone can point me in the
right direction.

Recently I've been going through an older book I have on CGI programming
to get a start. Most of it involves using Perl 5 though. The book is
"Sams Teach Yourself CGI Programming In A Week", by Rafe Colburn. Until
recently, things were going smoothly. Then, depending on the script
that I'd copy from the book, I'd start getting "Premature end of script
headers" errors in my error_log.

The script that I'm trying to get working right now is used for session
tracking. Simply passing information from an HTML page to the script,
which embeds the information in hidden fields.

But everytime I run the script I get a 500 Internal Server Error and the
error_log says: "Premature end of script headers: doform.cgi, referer:
http://testsite/form1.html"

I'm not sure if this is because of some configuration on my server or
because I'm using the CGI.pm module. This error only pops up when I
have "use CGI;" in the script.

Here's the script and HTML form if it'll help:

This is the form1.html page:
<html>
<head>
<title>Order Form</title>
</head>

<body>
<h1 alighn=center>Order Form, Part 1</h1>

<div align=center>
<form action="/cgi-bin/doform.cgi" method="post">
<table border=0>
<tr>
<td align=right>Name:</td>
<td><input type=text size=40 maxsize=80 name="address"></td>
</tr>
<tr>
<td align=right>Phone Number:</td>
<td><input type=text size=20 maxsize=20 name="phone"></td>
</tr>
<tr>
<td align=right>Email Address:</td>
<td><input type=text size=40 maxsize=40 name="email"></td>
</tr>
<tr>
<td><br></td>
<td><input type=submit value="Place Order"></td>
</tr>
</table>
</form>
</div>
</body>
</html>



This is the doform.cgi script.
#!/usr/bin/perl
use CGI;
$input = new CGI;

# The param() method contains all of the data gathered
# from the form, stored undre the name of each field.
# All this CGI script hass to do is store that data in the
# new form that it creates.

print $input->header;

print "<html>\n<head>\n<title>Order Form, Part 2</title>\n</head>\n";
print "<body>\n";
print "<h1 align=cneter>Order Form, Part 2</h1>\n";
print "<form action=\"cgi-bin\"doform2.cgi\" method=\"post\"\n";
print "<div align=center>";

print "<input type=hidden name=\"name\" value=\"";
print $input->param('name'), "\">\n";
print "<input type=hidden name=\"address\" value=\"";
print $input->param('address'), "\">\n";
print "<input type=hidden name=\"phone\" value=\"";
print $input->param('phone'), "\">\n";
print "<input type=hidden name=\"email\" value=\"";
print $input->param('email'), "\">\n";

print "<table border=0>\n";
print "<tr><td align=right>Credit Card Number:</td>\n";
print "<td><input type=text size=20 maxsize=20
name=\"ccnumber\"></td></tr>\n";
print "<tr><td align=right> Credit Card Expiration Date:</td>\n";
print "<td><input type=text size=4 maxsize=4
name=\"ccexpire\"></td></tr>\n";
print "<tr><td align=right>Shipping Options:</td>\n";
print "<td><select size=1 name=\"shipping\">\n";
print "<option value=\"overnight\">Overnight\n";
print "<option value=\"secondday\">Second Day\n";
print "<option value=\"parcel\">Parcel Post\n";
print "</select></td>\n</tr>\n";
print "<tr><td><br></td><input type=submit
value=\"PlaceOrder\"></td></tr>\n";
print "</table>\n</div>\n";
print "</form>\n";
print "</body>\n</html>\n";


Wow!!! That looks like alot. Well, any pointers would be appreciated.

Thanks,
Wayne D.
 
W

Wayne Deleersnyder

Hmmm.... kick me in the rear someone. Took me a couple of moments to
realize I hadn't properly set the permissions. D'oh!!!

Later,
Wayne D.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top