25 lines
749 B
Perl
25 lines
749 B
Perl
|
<HTML><HEAD>
|
||
|
<TITLE>A Simple Form-Based Example</TITLE>
|
||
|
</HEAD>
|
||
|
<FORM METHOD=GET ACTION="index.pl">
|
||
|
<H1>Please enter your name:</H1>
|
||
|
<P>First name: <INPUT NAME="first" TYPE=TEXT></P>
|
||
|
<P>Last name: <INPUT NAME="last" TYPE=TEXT></P>
|
||
|
<P><INPUT NAME="OK" TYPE=SUBMIT></P>
|
||
|
</FORM>
|
||
|
|
||
|
|
||
|
#!/usr/bin/perl
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use CGI;
|
||
|
my $cgi=new CGI; #read in parameters
|
||
|
#iterate over each parameter name
|
||
|
foreach ($cgi->param()) {
|
||
|
#modify and set each parameter value from itself
|
||
|
$cgi->param($_,ucfirst(lc($cgi->param($_))));
|
||
|
}
|
||
|
print $cgi->header(); #print a header
|
||
|
print $cgi->start_html("Welcome"); #generate HTML document start
|
||
|
print "<h1>Welcome, ",$cgi->param('first')," ",$cgi->param('last'),"</h1>";
|
||
|
print $cgi->end_html();
|