damian1301 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI; $query = new CGI; print $query->header; print $query->start_html(-title => "Guestbook Thing"); print $query->h1("Guestbook Thing"); &writeit($query); &readit($query); &printit($query); print $query->end_html; sub writeit{ my($query)=@_; print $query->startform; print "Name:"; my $name = $query->param('Name'); my $comments = $query->param('Comments'); print $query->textfield(-name =>'Name'), "<BR>"; print "Message:<BR>", $query->textarea(-name => "Comments",-rows = +> "10",-columns => "50"),"<BR>\n"; print $query->submit(-value => "Submit"); print $query->reset(-value=>Reset); print $query->hr(); print $query->endform; open(WRITE,">>guestbook.txt") || dienice("AHH $!"); print WRITE "$name::$comments\n"; #wonders if he should use th +e join function here... close(WRITE) || dienice("AHH $!"); } sub readit{ open(WRITE,"guestbook.txt") || dienice("AHH $!"); while (<WRITE>){ @_ = @text; } close(WRITE); @done = split(/:/,@text); } sub printit{ print $query->h2('Current Results'); print $query->hr; print "Message By: $done[0]<BR>"; print "<Message>: <Br><blockquote>$done[1]</blockquote></ +Message>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Test project....
by chromatic (Archbishop) on Nov 06, 2000 at 01:20 UTC | |
|
(Ovid) Re: Test project....
by Ovid (Cardinal) on Nov 06, 2000 at 01:16 UTC | |
|
Re: Test project....
by davorg (Chancellor) on Nov 06, 2000 at 14:51 UTC |