in reply to Re^2: appending to html at beginning
in thread appending to html at beginning

Hi Limbomusic,

I get 500 internal server error - because I guess the code isnt totally "right" ?

Yes, as described in Use strict and warnings, one of the first things that will happen is that you get errors because you need to declare your variables at or before their first use, for example my $navn = $FORM{navn};. The best way to debug this is by running the script from the command line and looking at the errors you get there. If you're just looking for compilation errors like undeclared variables, you can also run perl -c filename.pl.

Once you've got the script working locally, if you have trouble on the server, see CGI Help Guide and Troubleshooting Perl CGI scripts.

a working guestbook

Please be very careful with code you find like this - what you've shown has a security hole! The problem is print GUEST "<b>$FORM{'comments'}</b><br>\n"; - this allows the visitor to insert any arbitrary HTML code into the page, including JavaScript, which has the potential to seriously mess with the user. This is known as a Cross-site scripting (XSS) attack, for a tutorial see for example this.

Sorry, but based on the code I have to recommend removing that script from your site, or at least temporarily disabling it. Note: As I was writing this, hippo posted a reply pointing you to a better alternative.

Hope this helps,
-- Hauke D