Error,
Premature end of script headers
This is the error in the logs
Main Topics
Browse All TopicsI have been at this all night. How do I make a simple script that will open a .html file and display it in a text box and then when I hit submit, it will save the file. I have tried several ways of doing this and my script will not write to the file.
Thank You
My script:
#!/usr/bin/perl5
require "cgi-lib.pl";
require "adminconfig.pl";
&ParseForm(*FORM);
open (datafile, "pages/contact.htm") || die "can't open data.db";
@datafile = <datafile>;
close (datafile);
if ($FORM{'action'} eq "update") { &update; }
elsif ($FORM{'action'} eq "add") { &add; }
else { &main; }
sub main {
open(DATA,"pages/contact.h
@file = <DATA>;
close(DATA);
print "Content-type: text/html\n\n";
&header;
print "<form method=\"POST\" action=\"editpage.cgi\">
<p><textarea rows=\"15\" name=\"page\" cols=\"50\">
@file
</textarea>
<BR>
<input type=\"hidden\" name=\"action\" value=\"update\">
<input type=\"Submit\" value=\"Submit\" name=\"B2\"></p>
</form> \n";
$footer;
$FORM{'page'};
close (DATA);
}
sub update {
@page = $FORM{'page'};
close (DATA);
if ($FORM{'action'} eq "update") {
open(DATA, ">pages/contact.htm");
print DATA @page;
close(DATA);
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: prinxPosted on 1999-08-17 at 03:56:35ID: 1214949
sub update { htm");
open(DATA,">pages/contact.
@page = $FORM{'page'};
foreach $bit (@page) {
print DATA "$bit";
}
close(DATA);
}