Perl-cgi-form2

Source: Internet
Author: User
Code :

 

# ! /Usr/local/bin/perl
Use CGI ' : Standard ' ;

Print header;
Print start_html (" example CGI. PM form ");
Print "

example CGI. PM form

\ n ";
print_prompt ();
do_work ();
print_tail ();
Print end_html;

Sub Print_prompt {
Print Start_form;
Print " <Em> what's your name? </Em> <br> " ;
Print Textfield ( ' Name ' );
Print Checkbox ( ' Not my real name ' );

Print " <P> <em> Where can you find English sparrows? </Em> <br> " ;
Print Checkbox_group (
-Name => ' Sparrow locations ' ,
- Values => [England, France, Spain, Asia, Hoboken],
-Linebreak => ' Yes ' ,
-Defaults => [England, Asia]);

Print " <P> <em> How far can they fly? </Em> <br> " ,
Radio_group (
-Name => ' How far ' ,
- Values => [' 10 ft ' , ' 1 mile ' , ' 10 miles ' , ' Real far ' ],
-Default => ' 1 mile ' );

Print " <P> <em> what's your favorite color? </Em> " ;
Print Popup_menu (-name => ' Color ' ,
- Values => [ ' Black ' , ' Brown ' , ' Red ' , ' Yellow ' ],
-Default => ' Red ' );

PrintHidden ('Reference','Monty Python and the Holy Grail');

Print " <P> <em> what have you got there? </Em> <br> " ;
Print Scrolling_list (
-Name => ' Possessions ' ,
- Values => [ ' A coconut ' , ' A grail ' , ' An icon ' ,
' A sword ' , ' A ticket ' ],
-Size => 5 ,
-Multiple => ' True ' );

Print " <P> <em> Any parting comments? </Em> <br> " ;
Print Textarea (-name =>' Comments ' ,
-Rows => 10 ,
-Columns => 50 );

Print " <P> " , Reset ;
Print Submit ( ' Action ' , ' Shout ' );
Print Submit (' Action ' , ' Scream ' );
Print End_form;
Print " <HR> \ n " ;
}

SubDo_work {

Print "<H2> here are the current settings in this form </H2>";

For My $ Key (PARAM ){
Print " <Strong> $ key </strong>-> " ;
My @ Values = Param ( $ Key );
Print Join ( " , " , @ Values ), " <Br> \ n " ;
}
}

SubPrint_tail {
Print<End;
<HR>
<Address> Lincoln D. Stein </address> <br>
<A href ="/"> Home page </a>
End
}

 

More specific form (checkbox, check_group, radio_group, popup_menu, hidden, scrolling_list, textarea...), in manpage search: http://search.cpan.org /~ Markstos/cgi. pm-3.60/lib/cgi. PM

 

Complete!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.