#! /usr/bin/perl -w

##### Program description #######
#
# Title:     cgi2.pl
# Author(s): Mattias Ohlsson
# Description:
#   Small example of how to use the CGI module.
#
##################################

use CGI;
use strict;

my $cgi = new CGI;

print $cgi->header,
    $cgi->start_html(-title=>'A simple form example'),
    $cgi->h1('A simple form example'),
    $cgi->start_form,
    "What is your name? ", $cgi->textfield('name'), $cgi->p,
    "What is the combination", $cgi->p,
    $cgi->checkbox_group(-name=>'words',
			 -values=>['eenie','meenie','minie','moe'],
			 -defaults=>['eenie']), $cgi->p,
    "What is your favorite color? ",
    $cgi->popup_menu(-name=>'color',
		     -values=>['red','green','blue','yellow']),$cgi->p,
    $cgi->submit,
    $cgi->end_form,
    $cgi->hr;

if ( $cgi->param() ) {
    print "Your name is ",$cgi->em($cgi->param('name')),$cgi->p,
    "The keywords are: ",$cgi->em(join(", ",$cgi->param('words'))),$cgi->p,
    "Your favorite color is ",$cgi->em($cgi->param('color')),
    $cgi->hr;
}
print $cgi->end_html();
