Gossamer Forum
Home : General : Perl Programming :

Check box form/script

Quote Reply
Check box form/script
Am trying to create a form or cgi that will have the following:

checkbox 1 value = image 1
checkbox 2 value = image 2
checkbox 3 value = image 3
checkbox 4 value = image 4

and if checkbox 1 and 3 are checked, it will only display images # 1 & 3 on the results page.. tried to use java, but it's too much of a headache
Can anyone point me in the right direction??
Thanks,

Just a followup, here is what I'm trying to use...

Code:

<form method="post" action="/cgi-bin/test.pl">
<b>Check Your Favorite Pass Times:</b><br>
<input type="checkbox" name="a" value="<img src='/images/image1.gif'>"><img src="/images/image1.gif"><br>
<input type="checkbox" name="a" value="<img src='/images/image2.gif'>"><img src="/images/image2.gif"><br>
<input type="checkbox" name="a" value="<img src='/images/image3.gif'>"><img src="/images/image3.gif"><br>
<input type="checkbox" name="a" value="<img src='/images/image4.gif'>"><img src="/images/image4.gif"><br>
<input type="checkbox" name="a" value="<img src='/images/image5.gif'>"><img src="/images/image5.gif"><br>
<input type="checkbox" name="a" value="<img src='/images/image6.gif'>"><img src="/images/image6.gif"><br>
<input type="submit" value="Submit"><br>
</form>







#!/usr/bin/perl
#test.pl
read(STDIN, $buffer,$ENV{'CONTENT_LENGTH'});
$buffer =~ tr/+/ /;
$buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$buffer =~ s/<!--(.|\n)*-->/ /g;
$buffer =~ tr/\\|[|]|<|!|"|$|{|}|*|#|'|>|||;|%/ /;
@pairs = split(/&/,$buffer);
foreach $pair(@pairs){
($key,$value)=split(/=/,$pair);
$formdata{$key}.="$value";
}
print "Content-type: text/html\n\n";
print <<End_of_Body;
<html>
<head><title>test</title>
</head>
<body>
<p>Awards:</p>
End_of_Body
while (($key,$value)= each(%formdata)){
print <<End_of_Loop;
<p>$value.</p>
<br>
End_of_Loop
}
print <<End_of_Document;
<p>End of Awards</p>
</body>
</html>
End_of_Document

</not a clue>

Last edited by:

Dinky: Oct 31, 2004, 3:48 PM
Subject Author Views Date
Thread Check box form/script Dinky 6438 Oct 31, 2004, 2:51 PM
Thread Re: [Dinky] Check box form/script
Dinky 6334 Oct 31, 2004, 5:17 PM
Post Re: [Dinky] Check box form/script
Watts 6289 Nov 1, 2004, 8:03 AM