#!/usr/local/bin/perl

use CGI;

$query = new CGI;
print $query->header;
print $query->start_html('Multiple Forms');
print "
Multiple Forms
\n";

# Print the first form
print $query->startform;
$name = $query->remote_user || 'anonymous@' . $query->remote_host;

print "What's your name? ",$query->textfield('name',$name,50);
print "<P>What's the combination?<P>",
        $query->checkbox_group('words',['eenie','meenie','minie','moe']);
print "<P>What's your favorite color? ",
        $query->popup_menu('color',['red','green','blue','chartreuse']),
	"<P>";
print $query->submit('form_1','Send Form 1');
print $query->endform;

# Print the second form
print "
\n";
print $query->startform;
print "Some radio buttons: ",$query->radio_group('radio buttons',
						 [qw{one two three four five}],'three'),"\n";
print "<P>What's the password? ",$query->password_field('pass','secret');
print $query->defaults,$query->submit('form_2','Send Form 2'),"\n";
print $query->endform;

print "
\n";

$query->import_names('Q');
if ($Q::form_1) {
    print "
Form 1 Submitted
\n";
    print "Your name is $Q::name\n";
    print "<P>The combination is: {",join(",",@Q::words),"}\n";
    print "<P>Your favorite color is $Q::color\n";
} elsif ($Q::form_2) {
    print <<EOF;

Form 2 Submitted
<P>The value of the radio buttons is $Q::radio_buttons
<P>The secret password is $Q::pass
EOF
    ;
}
print qq{<P>Other examples};
print qq{<P>Go to the documentation};

print $query->end_html;

