Cybertronic
Technical User
- May 18, 2006
- 19
I'm using the following code for checkboxes in my HTML form:
my @color = param('color');
foreach my $color (@color) {
print "You picked $color.<br>\n";
}
At the moment I'm using this code to match an element from my array:
if ($color[0] eq "name of color")
The problem is, is there an alternative to $color[0]? If I use [0], that's only for the very first checkbox as it won't be ticked all the time (there's other checkboxes). I've tried using:
if ($color eq "name of color")
Sadly it doesn't work
Please help!
my @color = param('color');
foreach my $color (@color) {
print "You picked $color.<br>\n";
}
At the moment I'm using this code to match an element from my array:
if ($color[0] eq "name of color")
The problem is, is there an alternative to $color[0]? If I use [0], that's only for the very first checkbox as it won't be ticked all the time (there's other checkboxes). I've tried using:
if ($color eq "name of color")
Sadly it doesn't work
Please help!