Loading ...
Sorry, an error occurred while loading the content.

[PBML] checkbox problem

Expand Messages
  • James Fox
    Okay, this is probably an easy problem, but knowing me I m going to make it sound complicated :-) Below is a script where for each list in a database, it
    Message 1 of 2 , Oct 19, 1999
    • 0 Attachment
      Okay, this is probably an easy problem, but knowing me I'm going
      to make it sound complicated :-)

      Below is a script where for each list in a database, it displays a
      checkbox and the list name.
      When the submit button is pressed, those checkboxes which the
      user 'checks' then have a value of 'on'.

      What I want to do when this is submitted is for each checkbox with
      the value 'on', display $list. (the name of the list)

      How can I do this? (code below).

      foreach $list(@lists) {
      $count = &lyris::MemberCount($list);
      $desc = &lyris::SiteAttribs($desc);

      %desc = &lyris::ListAttribs($list);
      %security = &lyris::ListAttribs($list);
      print "<p><input type=\"checkbox\" name=$list\n";
      print " value=\"on\n";
      print "\">\n";
      print "<font face=\"Verdana, Arial, Helvetica, sans-serif\"
      size=\"2\">$list\n";
      print " (<b>$security{'Security'}</b>)\n";
      print "<font size=\"1\">Info- $desc{'DescShort'} - <b>no. of
      members</b>- $count.\n";
      print "</font> </font><br>\n";
      };

      :: James Fox
      :: DJ Associates
      :: Tel: +44 (0)114 2210525
      :: Fax: +44 (0)114 2493450
    • Jeff Boes
      ... Are you using CGI.pm? If so, then this is easy: foreach (@lists) { print $_ if (param($_)); } What might be more useful is if you gave all the checkboxes
      Message 2 of 2 , Oct 20, 1999
      • 0 Attachment
        > -----Original Message-----
        > From: James Fox [mailto:james@...]
        > Sent: Tuesday, October 19, 1999 7:26 am
        > To: perl-beginner@egroups.com
        > Subject: [PBML] checkbox problem
        >
        >
        > Okay, this is probably an easy problem, but knowing me I'm going
        > to make it sound complicated :-)
        >
        > Below is a script where for each list in a database, it displays a
        > checkbox and the list name.
        > When the submit button is pressed, those checkboxes which the
        > user 'checks' then have a value of 'on'.
        >
        > What I want to do when this is submitted is for each checkbox with
        > the value 'on', display $list. (the name of the list)
        >
        > How can I do this? (code below).

        Are you using CGI.pm? If so, then this is easy:

        foreach (@lists) {
        print $_ if (param($_));
        }

        What might be more useful is if you gave all the checkboxes the same name,
        and instead of giving them the value 'on' when checked, set the 'on' value
        to the list name. Then for

        <input type="checkbox" name="list" value="$list">

        on return you have

        @lists_checked = param('list');


        ----
        WARNING: This message contains Thought and Thought By-Products.
        _________
        Jeff Boes <>< jboes@...
        Mur Consulting http://www.qtm.net/~jboes/
      Your message has been successfully submitted and would be delivered to recipients shortly.