SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple select options

    I have rows of database records which are displayed in a table. Each row consists of an input field, a select drop-down option and a checkbox.

    for the id/name I'm using
    Code:
    name='field[]'
    which seems to work fine when I access it from within PHP using
    Code:
    $_POST['field'][$i]
    but it doesn't work for the select tag.

    I'm using
    Code:
    <select name='field2[]'>
    Any ideas?

  2. #2
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know whether that's of any help but as far as I remember, [ and ] are not allowed (at least not recommended) within the name/id-attribute of an html-tag.

    Edit: These chars are allowed:
    : - _ .
    Dan G
    Marketing Strategist & Consultant

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you know how I can go about doing the above? Would I need to give each name a unique one like <select name="foo_1"> etc?

  4. #4
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forget what I said previously, I'm not that much into php yet. Your question is better suited in the php forum than here in the html. A bit more of your php and form code could also help.

    But maybe this already helps you: http://www.onlamp.com/pub/a/php/2004...mhandling.html Look at "2. Put [] at the end of the name of a multivalued form parameter."
    Dan G
    Marketing Strategist & Consultant

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link c2uk that's what I was looking for.


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
  •