--- "Simon K. Chan" <[EMAIL PROTECTED]> wrote:
> Hey Everybody,
> 
> I have the following code:
> 
> $k = 0;
> foreach $item (@array){
> 
> print "$item";
> 
> print qq{<input type=checkbox name="$k">};
> 
> ++$k;
> }
> 
> print qq{<input type="hidden" name="kvalue" value="$k">};
> 
> What is the proper syntax to see if the checkbox had been checked or not?
> I've tried this:
> 
> my $check = param('$k');

First, using single quotes does not allow interpolation.  You need double quotes.  
Second, a
checkbox will shouldn't have any value sent over if not checked.  Therefore, what you 
can do is
this:

    my $check = param( $k );
    if ( defined $check ) {
        # do something
    }

Of course, that's simplified.  In reality, you'll want to validate that the data is in 
a format
that you expected.  It's very easy for a malicious user to change.  See 'perldoc 
perlsec' for
details on using taint checking to protect your data.

Cheers,
Curtis "Ovid" Poe
 

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to