--- [EMAIL PROTECTED] wrote:
> Here the doubt,
> 
> I have a Form with some radio and checkbox groups in it. when 
> the user fillout the form and then hit the Submit button a perl 
> program is invoke depending on how the user fill. if i want to 
> know all of the field names and values that have the form i do 
> this:
> 
> foreach my $name (param)
> {
>      print "$name - " . param[$name];
> }
> 
> that's OK and I got a list of all the name and values if the 
> user complete the form but if the user didn't complete it the 
> param($name) didn't retrive any. The foreach loop didn't print 
> anything if the user hit the Submit button without fill 
> anything. I want to my program print all the names of the form 
> if the user fill it or if he didn't.
> 
> I tyr this:
> 
> $name = param("name") || "";
> 
> but it doesn't
> work.

In a nutshell, to get one value, call param() in scalar context.  Call it in list 
context to get
all values.

    my $single_value    = param( 'someval' );  # use this if you only have one value
    my @multiple_values = param( 'somevals' ); # use this if you have multiple values

To get your snippet to work, try the following:

    foreach my $name (param)
    {
       my @vals = param( $name );
       print "$name - @vals\n";
    }

Cheers,
Curtis "Ovid" Poe

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

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

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

Reply via email to