60 lines
1.1 KiB
Perl
60 lines
1.1 KiB
Perl
|
<html>
|
||
|
<head>
|
||
|
<title>form page</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<p>heresmy test form</p>
|
||
|
<form method = "post" action = "/your.pl">
|
||
|
|
||
|
<p>First name:
|
||
|
<input name = "firstName" type = "text" size = "20"></p>
|
||
|
|
||
|
<p>Last name:
|
||
|
<input name = "lastName" type = "text" size = "20"></p>
|
||
|
|
||
|
<p>Phone number:
|
||
|
<input name = "phone" type = "text" size = "20"></p>
|
||
|
|
||
|
<p>Date (MM/DD/YY):
|
||
|
<input name = "date" type = "text" size = "20"></p>
|
||
|
|
||
|
<p>Time (HH:MM:SS):
|
||
|
<input name = "time" type = "text" size = "20"></p>
|
||
|
|
||
|
<input type = "submit" value = "submit">
|
||
|
<input type = "reset" value = "reset">
|
||
|
|
||
|
</form>
|
||
|
</body>
|
||
|
|
||
|
</html>
|
||
|
|
||
|
#your.pl
|
||
|
|
||
|
#!/usr/bin/perl
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use CGI ':standard';
|
||
|
|
||
|
my $firstName = param( "firstName" );
|
||
|
my $lastName = param( "lastName" );
|
||
|
my $phone = param( "phone" );
|
||
|
my $date = param( "date" );
|
||
|
my $time = param( "time" );
|
||
|
|
||
|
print header();
|
||
|
print start_html( -title => "form page" );
|
||
|
|
||
|
if ( $firstName =~ /^\w+$/ ) {
|
||
|
print "<p>Hello there \L\u$firstName.</p>";
|
||
|
}
|
||
|
|
||
|
if ( $lastName =~ /^\w+$/ ) {
|
||
|
print "<p>Hello there Mr./Ms. \L\u$lastName.</p>";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
print end_html();
|