Mega Code Archive

 
Categories / Perl / CGI
 

Demonstrates GET method with HTML form

# Name this Perl script as test.pl use warnings; use strict; use CGI qw( :standard ); our ( $name, $value ) = split( '=', $ENV{ QUERY_STRING } ); print header(), start_html( 'Using GET with forms' ); print p( 'Enter one of your favorite words here: ' ); print '<form method = "GET" action = "test.pl">'; print '<input type = "text" name = "word">'; print '<input type = "submit" value = "Submit word">'; print '</form>'; if ( $name eq 'word' ) {    print p( 'Your word is: ', b( $value ) ); } print end_html();