You can create forms with CGI.pm using functions that have obvious names.
#!/usr/bin/perl
# file: final_exam.pl
use CGI ':standard';
print header;
print start_html('Your Final Exam'),
h1('Your Final Exam'),
start_form,
"What's your name? ",textfield(-name=>'first_name'),
p,
"What's the combination?",
p,
checkbox_group(-name => 'words',
-values => ['eenie','meenie','minie','moe'],
-defaults => ['eenie','minie']),
p,
"What's your favorite color? ",
popup_menu(-name => 'color',
-values => ['red','green','blue','chartreuse']),
p,
submit,
end_form,
hr;
if (param()) {
print
"Your name is: ",param('first_name'),
p,
"The keywords are: ",join(", ",param('words')),
p,
"Your favorite color is: ",param('color'),
hr;
}
print end_html; |
http://your.site/cgi-bin/final_exam.pl
Run perldoc CGI for details:
|
| Contents | Next |