Click to See Complete Forum and Search --> : Please help me one more time


Dark Dragon
06-03-2003, 10:39 PM
Okay...since my guestbook is nearing completion I find I need a CGI script to make it display the results of whoever makes entries...I found a script but I am unsure if this is the correct one...please take a look and tell me if this is the right one:

#!/user/bin/perl
print "Content-Type:text/html\n\n";
print "<html><head>\n";
print "<title>Post Method</title>\n";
print "<head>\n";
print "<body>\n";
read(STDIN,$buffer ,$ENU{'CONTENT_LENGTH'});
print $buffer;
print "</body></html>\n";

Thanks a bunch

P.S I am not trying to bug anyone but I found a few scripts but it is unclear to me what they do

jeffmott
06-03-2003, 11:05 PM
Well, first things first, the ENU should be ENV. Otherwise, this script will echo back the encoded input it receives from a form. Assuming the enctype attribute in the form tag was omitted for now, the results would look something like the example belowname=John+Doe&pnum=555-5555

Dark Dragon
06-03-2003, 11:29 PM
Hmmm...if that is the results it will show..thenI gotta find a better script then.

I just want it to display like a guestbook...y'know, like this:

Name: So and so

URL: www.something.com

Message: Blah-blah-blah

Well...I think I am close though...thanks a bunch

Charles
06-04-2003, 06:20 AM
If you are going work with forms then you will find the ubiquitous CGI.pm module helpful. See http://www.perldoc.com/perl5.8.0/lib/CGI.html.

#!user/local/bin/perl
use strict;
use CGI qw(:all);
my @names = param;
map {$_ = "$_ = ".param($_)} @names;
print header, start_html('Example'), ul(li(\@names)), end_html;

But you are going to want to store the values somewhere so you are going to have to learn Perl to know how to do that.