#!/usr/local/bin/perl push(@INC,'..'); require CGI::Form; $query = new CGI::Form; print $query->header; &print_head; &print_prompt($query); &do_work($query); &print_tail; sub print_head { print < Example CGI::Form

Example CGI::Form

END } sub print_prompt { local($query) = @_; print $query->startform; print "What's your name?
"; print $query->textfield('name'); print $query->checkbox('Not my real name'); print "

Where can you find English Sparrows?
"; print $BLANK; print $query->checkbox_group('Sparrow locations', [England,France,Spain,Asia,Hoboken], [England,Asia]); print "

How far can they fly?
", $query->radio_group('how far', ['10 ft','1 mile','10 miles','real far'], '1 mile'); print "

What's your favorite color? "; print $query->popup_menu('Color',['black','brown','red','yellow'],'red'); print $query->hidden('Reference','Monty Python and the Holy Grail'); print "

What have you got there? "; print $query->scrolling_list('possessions', ['A Coconut','A Grail','An Icon', 'A Sword','A Ticket'], undef, 10, 'true'); print "

Any parting comments?
"; print $query->textarea('Comments',undef,10,50); print "

",$query->reset; print $query->defaults; print $query->submit('Action','Shout'); print $query->submit('Action','Scream'); print $query->endform; print "


\n"; } sub do_work { local($query) = @_; local(@values,$key); print "

Here are the current settings in this form

"; foreach $key ($query->param) { print "$key -> "; @values = $query->param($key); print join(", ",@values),"
\n"; } } sub print_tail { print <
Lincoln D. Stein

Home Page END } #######################################################################