Link to home
Start Free TrialLog in
Avatar of rgbcof
rgbcof

asked on

perl, cgi to read whether a check box value if it is checked

<INPUT TYPE="checkbox" NAME="snif0" checked="yes" >emA
<INPUT TYPE="checkbox" NAME="snif1" checked="no" >emB
<INPUT TYPE="checkbox" NAME="snif2" checked="no" >emC
<INPUT TYPE="checkbox" NAME="snif3" checked="yes" >emD

If the boxes are checked then add to array @sniffList.  So @snifList should have emA and emD?
Avatar of Pieter Marais
Pieter Marais
Flag of South Africa image

Hi there,
Here is some snippets of how I do it.

Hope it helps ^_^
HTML
----------

<input type="checkbox" name="snif" value="emA"> emA<br>
<input type="checkbox" name="snif" value="emB"> emB<br>
<input type="checkbox" name="snif" value="emC"> emC<br>
<input type="checkbox" name="snif" value="emD"> emD<br>

-------
PERL
-------

my @snif= param('snif');
foreach my $snif(@snif) {
   print "You picked $snif.<br>\n";
}

Open in new window

Avatar of rgbcof
rgbcof

ASKER

Got an error:

Undefined subroutine &main::param called at  /var/www/cgi-bin/p ....
ASKER CERTIFIED SOLUTION
Avatar of Pieter Marais
Pieter Marais
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgbcof

ASKER

Very cool.