Solved

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

Posted on 2010-11-11
4
577 Views
Last Modified: 2013-12-25
<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?
0
Comment
Question by:rgbcof
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:EZFrag
ID: 34118137
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

0
 

Author Comment

by:rgbcof
ID: 34118330
Got an error:

Undefined subroutine &main::param called at  /var/www/cgi-bin/p ....
0
 
LVL 9

Accepted Solution

by:
EZFrag earned 250 total points
ID: 34118343
Oh, sorry 'bout that, here is the full source for the perl script.
#!/usr/bin/perl

use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

print header;
print start_html;

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


print end_html;

Open in new window

0
 

Author Closing Comment

by:rgbcof
ID: 34118349
Very cool.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question