programming-examples/perl/CGI/Values Carried Between Pages.pl
2019-11-15 12:59:38 +01:00

37 lines
646 B
Perl

#!/usr/bin/perl -T
use strict;
use CGI qw/:standard/;
print header;
if (param('color')) {
print start_html('Hello'),
"Hello ", param('name'),p,
"Your favorite color is: ",param('color'),p,
hr;
}
elsif (param('name')) {
print start_html('Hello'),
"Hello ",
param('name'),
p,
start_form,
"Please enter your favorite color: ",textfield('color'),
hidden(-name=>'name',-value=>param('name')),
submit,
end_form,
hr;
} else {
print start_html('Hello'),
start_form,
"Enter your name: ",textfield('name'),
submit,
end_form,
hr;
}
print end_html;
exit;