Actually the form has several checkboxes with the same name. I figured it out though. 
The script went through all params in a loop in scalar context so that made that param 
a single value. 

SO the correct format I found to be 
@array $cgi->param('checkbox');

The above does get an array but only if you havn't done any kind of manipulation to it 
in scalar contect previously

Foreach $p(@params) { ...

Thanks

Dan

-----Original Message-----
From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
Sent: Friday, December 20, 2002 2:58 PM
To: [EMAIL PROTECTED]
Subject: Re: CGI.pm param


Dan


Dan

Have you generated a checkbox with

    $cgi->checkbox (-name => 'checkboxname', ...)

because this will create only an isolated single checkbox. To create a group of 
checkboxes use

    $cgi->checkbox_group (-name => 'groupname', ...)

which will then return a list of only the _checked_ boxes when

    $cgi->param ('groupname')

is called.

HTH,

Rob

"Dan Muey" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I'm starting to use CGI.pm to parse input instead of cgi_lib.lib
>
> What I need to do is get the values of a series of checkboxes into an
array so I can do  foreach over them .
>
> EXAMPLE :
>
> @check_box_entries = $cgi->param('checkboxname'); $check_box_entries = 
> $cgi->param('checkboxname');
>
> both just have the first checkbox checked value.
>
> What i need to do is basically :
>
> @values = ????
> foreach $chk(@values) { print "You chose $chk <br> \n"; }
>



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


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

Reply via email to