#!/usr/local/bin/perl ## ## Print tags for beginng of HTML document to STDOUT ## print < Welcome to the JDC

Welcome to the JDC

EOM

############################################################
##
## Read the parameters passed by the HTML form 
## from the QUERY_STRING environment variable.
##
$query_string = $ENV{'QUERY_STRING'};

##
## Decode the form data encoded in the URL.
##
$query_string =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
$query_string =~ s/\+/ /g;

##
## Break up the parameters passed in the URL into an
## array of key-value pairs.
##
@pairs = split (/&/, $query_string);

##
## Iterate over the array of key-value pairs,
## break up each pair into a key component and
## a value component.  Build a hashtable, called
## form_data, allowing values to retrieved
## using a name key.
##
foreach $pair (@pairs) {
    ($key, $value) = split (/=/, $pair);
    $form_data{$key} = $value;
}

##
## Now parameter values can be retrieved from the
## hashtable by supplying a name key.
##
$firstname = $form_data{"firstname"};
$lastname = $form_data{"lastname"};

##
## This is the dynamic content generated in
## response to the HTML form submission.
##
print "\n

Greetings

\n"; print "Hello $firstname $lastname. Welcome to the JDC.\n\n"; ############################################################ ## ## Print tags for end of HTML document to STDOUT ## print < EOM close OUT;