It would be nice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sheldonlg

    It would be nice

    I think this capability is lacking in php.

    Suppose there is a group of checkboxes all named "procedure" . Doing a
    $_POST['procedure'] returns all the ones that are checked and not the
    ones that are not checked. It would be nice if there were a way to get
    them all and then discern which were checked. [Note: This can be done
    in Javascript with document.getEle mentsByName('pr ocedure') and then
    testing whether each of the child nodes is checked].

    This post arose from a question I had posted in comp.lang.mysql . I have
    a group of checkboxes and I would like to be able to put them all into
    the database table, specifying which was checked and which was not. The
    only way I can see doing that is to (a) sort the array by ID that is
    returned from the $_POST and (b) compare each element in it with a list
    of all the checkboxes ordered by ID used to generate the form. A little
    tedious, but it would work.
  • Radek N.

    #2
    Re: It would be nice

    sheldonlg pisze:
    I think this capability is lacking in php.
    >
    Suppose there is a group of checkboxes all named "procedure" . Doing a
    $_POST['procedure'] returns all the ones that are checked and not the
    ones that are not checked. It would be nice if there were a way to get
    them all and then discern which were checked. [Note: This can be done
    in Javascript with document.getEle mentsByName('pr ocedure') and then
    testing whether each of the child nodes is checked].
    It has nothing to do with PHP.

    --
    Radek N.



    Comment

    • Jessica Griego

      #3
      Re: It would be nice


      <sheldonlgwro te in message
      news:uZOdnZUEVq DYsYHUnZ2dnUVZ_ qHinZ2d@giganew s.com...
      >I think this capability is lacking in php.
      >
      Suppose there is a group of checkboxes all named "procedure" . Doing a
      $_POST['procedure'] returns all the ones that are checked and not the ones
      that are not checked. It would be nice if there were a way to get them
      all and then discern which were checked. [Note: This can be done in
      Javascript with document.getEle mentsByName('pr ocedure') and then testing
      whether each of the child nodes is checked].
      >
      This post arose from a question I had posted in comp.lang.mysql . I have a
      group of checkboxes and I would like to be able to put them all into the
      database table, specifying which was checked and which was not. The only
      way I can see doing that is to (a) sort the array by ID that is returned
      from the $_POST and (b) compare each element in it with a list of all the
      checkboxes ordered by ID used to generate the form. A little tedious, but
      it would work.
      That goes to design or your script and implementation of the browser - which
      is simply conforming to the w3c standard. You can define, whether from a
      static array or from a db, what checkboxes are going to be shown. From
      there, all you have to do is an array_intersect and array_diff to see what
      boxes were and were not checked.

      Other than making a mountain from a mole hill, this is a non-issue and
      doesn't relate to php at all. If I've got an options page with dozens of
      checkboxes, I don't want to consume bandwidth or processing time toting
      superfluous information back and forth between client and server. A better
      design on your end will help you appreciate the *good* implementation of the
      w3c spec concerning checkboxes.

      If you must mangle things, or if this will help you qwell your bitching, why
      not use javascript on submit and simply create hidden inputs that coorespond
      to each checkbox and whos values are either 1 or 0 depending on the checkbox
      state at the time of submit. It would be nice if more people thought about
      things before complaining to group of people who couldn't care less about
      *off* topic, self-imposed shortcomings. THAT is what would be nice.


      Comment

      • Curtis

        #4
        Re: It would be nice

        On Thu, 13 Nov 2008 08:31:13 -0500, sheldonlg <sheldonlgwrote :
        I think this capability is lacking in php.
        >
        Suppose there is a group of checkboxes all named "procedure" . Doing a
        $_POST['procedure'] returns all the ones that are checked and not the
        ones that are not checked. It would be nice if there were a way to get
        them all and then discern which were checked. [Note: This can be done
        in Javascript with document.getEle mentsByName('pr ocedure') and then
        testing whether each of the child nodes is checked].
        >
        DOM != POST/GET request.
        This post arose from a question I had posted in comp.lang.mysql . I have
        a group of checkboxes and I would like to be able to put them all into
        the database table, specifying which was checked and which was not. The
        only way I can see doing that is to (a) sort the array by ID that is
        returned from the $_POST and (b) compare each element in it with a list
        of all the checkboxes ordered by ID used to generate the form. A little
        tedious, but it would work.
        Sounds like you're trying to use the wrong approach. This has
        nothing to do with PHP and everything to do with how the (X)HTML spec
        defines "successful controls."[1] Since your "problem" is actually
        standard HTML behavior, it is the same with any language processing
        the request.

        Before attempting to fault a language, you should attempt to better
        understand the issue at hand.

        [1] <URL:http://www.w3.org/TR/html4/interact/...ml#successful-
        controls>
        --
        Curtis
        $email = str_replace('si g.invalid', 'gmail.com', $from);

        Comment

        Working...