Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, the information is taken from the module, placed into variables, then is placed amongst the HTML, and written to a file. But I can't seem to get it to work.#!usr/bin/perl #Start the CGI! use CGI; #Declare a new page for the information my $Page = new CGI; #Put the data from the form into variables my $Name = $Page->param(Name); my $E_mail = $Page->param(E-mail); my $Comment = $Page->param(Comment); #A little bit of environment variables my $Browser = $ENV{"HTTP_USER_AGENT"}; #Open the file where the information will go. open(GUEST, '>>../GuestBook/GuestBook.txt') or die "The file could not + be opened."; #Open up the file for the counter to... "count" the people open(COUNT, '../Counter/counter.txt') or die "The File could not be op +ened."; #Save the contents to a variable $Number = <COUNT>; print COUNT $Number++; #Close it up close(COUNT); #Print all of the information, with the proper #HTML, to the file. print GUEST <<GuestStuff; <table border="0" cellspacing="1" cellpadding="0"> <tr width="200"> <td> <p style="size: 30px;">Otaku \#$Number.</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">Name: $Name</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">E-mail: $E_mail</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">Comment: $Comment</p> </td> </tr> <tr> <td clas="Cell"> <p style="color: white;">Your Browser type: $Browser</p> </td> </tr> </table> GuestStuff #Print the HTML MIME header from CGI. print $Page->header; #Print to the screen print <<HYPERSTUFF; <html> <head> <title> Thank you! </title> <META HTTP-EQUIV="Refresh" CONTENT="10; URL=http://storm.prohosting.c +om/ertain"> <LINK REL="stylesheet" HREF="Style.css" TYPE="text/css"> </head> <body> <p>Thank you for your input! It will be on the GuestBook page, if y +ou want to see it. You will now be redirected to the main page.</p> <p>If it doesn't work in 10 seconds, here's the <a href="http://storm.prohosting.com/ertain">link</a>. </p> </body> </html> HYPERSTUFF #close the GuestBook file close(GUEST);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Writing to a file
by Asim (Hermit) on Nov 21, 2001 at 00:43 UTC | |
|
Re: Writing to a file
by dash2 (Hermit) on Nov 21, 2001 at 00:04 UTC | |
|
Re: Writing to a file
by hotshot (Prior) on Nov 21, 2001 at 14:10 UTC |