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

[PBML] Re: checkbox problem

Expand Messages
  • 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 1 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.