Please send questions to st10@humboldt.edu .
#!/usr/bin/perl -w

#######################################################
# lab09_play1
#
# how hard are check boxes and radio buttons, anyway?
#
# by Sharon Tuttle 
#
# last modified: 10-21-04
#######################################################

open HTML_INFO, ">> lab09_play1_sent_info"
   or die "Cannot open lab09_play1_sent_info: $!";

# first: get the information from the HTML form as one big string:

read STDIN, $info_string, $ENV{"CONTENT_LENGTH"}; 

# try to save it to lab09_play1_sent_info:

print HTML_INFO "-----------------------------------------------\n";
print HTML_INFO "$info_string\n";

# now let's slice'n'dice it, and see how it turns out:

# first, change each = to & ? (want to be split into separate values,
#    I think)

$info_string =~ s/=/&/g;

# ...and change each + back to a blank now --- they won't be
#    accidentally split on now, with the &'s in place;

$info_string =~ s/\+/ /g;

# and change single quotes -- %27 --- back to '?

$info_string =~ s/%27/'/g;

print HTML_INFO "$info_string\n";

# split on & 

@fields_and_values = split /&/, $info_string;

print HTML_INFO "@fields_and_values\n";

# store fields and their values into hash

%field_value_hash = @fields_and_values;

@ck = %field_value_hash;
print HTML_INFO "@ck\n";

print HTML_INFO "\nHere are fields and their values:\n";

print "Content-type: text/html", "\n\n";
print "<html>\n";
print "<head><title>Confirmation</title></head>\n";
print "<body><h1>Confirmation</h1>\n";
print "<hr>\n";
print "Information transferred?<br>";

foreach $field (sort keys %field_value_hash)
{
    print HTML_INFO "$field => $field_value_hash{$field}\n";
    print           "$field => $field_value_hash{$field} <br>\n";
}
    
print "</body>\n";
print "</html>\n";


close HTML_INFO;

# try to send back a confirmation page



# end of lab09_play1.pl