#!/usr/bin/perl
use CGI ':standard';
print header(), start_html();
if (param()) {
my $which_button = param('which_button');
if ($which_button eq 'Save') { save() }
elsif ($which_button eq 'Preview') { preview() }
else { print font({COLOR => 'red'}, "There is no such button!
") }
}
print start_form(),
"Name: ", textfield('name'), br(),
"Comments:
", textarea(-NAME => 'comments',
-ROWS => 7, -COLUMNS => 40), br(),
submit(-NAME => 'which_button', -VALUE => 'Save'),
submit(-NAME => 'which_button', -VALUE => 'Preview'),
end_form();
print end_html();
####################
sub save {
print h1("Saved."), hr();
}
sub preview {
my $comments = param('comments');
print p(font({COLOR => 'blue'}, $comments));
}