Basic HTML version of Foils prepared Sept 20 97

Foil 80 Using CGI.pm - Form Generation

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 Here's an example of a form generated by CGI.pm function calls:
2 print start_form( # <FORM> tag
  • -method=>'POST', # default
  • -action=>'fill-out-form.pl'
  • );
3 print p( "Type in your street address:\n",
  • textfield( # a textfield
    • -name=>'address', -size=>36
  • )
  • );
4 print p( 'What kind of pizza would you like?' );
5 print blockquote( # requires :shortcuts
  • radio_group(
    • -name=>'topping',
    • -values=>['Pepperoni','Sausage','Anchovy']
  • ) # an anonymous array
  • );
6 print p( 'To place your order, click here:',
  • submit('Order Pizza'), # submit button
  • reset('Clear') # reset button
  • );
7 print end_form(); # </FORM> tag

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Sep 21 1997