on Tue, 12 Nov 2002 04:47:04 GMT, [EMAIL PROTECTED] (Mariusz)
wrote: 

> They give an option to save ads for later display on one page. I
> looked up the source code and noticed that all their checkboxes
> have the same name (printad) and the values grow from zero up.
> That's easy, but how do you later capture which ad to display?
> When I tried to "param" the values from several checkboxes named
> the same but with different values (0,1,2,...) I just got zero
> from "print $checkbox;" 

The following bare-bones code works as advertised:

    #! /usr/bin/perl -w
    use strict;

    use CGI qw(:standard);

    print header(), start_html();

    print start_form(),
          checkbox_group(-name=>'mygroup', -values=>[1..10]),
          submit(-name => 'action', -value => 'Submit'),
          end_form();

    if (param('action') && param('action') eq 'Submit') {
        my @checked_values = param('mygroup');
        print p("@checked_values");
    }

    print end_html(); 

Also note that they carry selected ads in previous pages forward in 
hidden variables, as in

    print hidden(-name => 'mygroup', -value => '1');

which ensures they will be part of the param('mygroup') array.

-- 
felix

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

Reply via email to