SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru downtroden's Avatar
    Join Date
    Dec 2004
    Location
    illinois
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    best way to loop over checkboxes in form

    okay, i've got a form and it's pulling questions from a db (60 total questions right now, may grow OR shrink) and the user will eventually check a checkbox next to the question if they want to include it or not in a job posting.

    What would be the best way for me to loop over the checkboxes that HAVE been submitted? Name/id is setup like so question_#id#, so would I loop over the complete fieldnames list and findNoCase() fields that start with question_ and then make a new list with just numbers?

    It's the end of the day and i'm not sure if my logic is sound.
    your brain reacts in the same way whether you are
    looking at something or thinking about it...

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you give the checkboxes the same name, you won't need to make a list. The values of the selected boxes will already be a list.

  3. #3
    SitePoint Guru downtroden's Avatar
    Join Date
    Dec 2004
    Location
    illinois
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks
    your brain reacts in the same way whether you are
    looking at something or thinking about it...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •