SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP: Handling Multiple Selects from an HTML Form

    Hi:

    I'm trying to figure out how, in PHP, to handle incoming data from an HTML form when a "multiple"-enabled drop-down list is used. Using the "get" method for illustration purposes, if I select two band names, for example, from a drop down list, the resulting URL might look something like this:

    http://www.domain.com/testing.php?Ba...ds=VertHorizon

    The second value simply overwrites the first value in my PHP script instead of allowing me to use both values. How do I combat this? I fear that this is incredibly basic and that my brain just isn't functioning.

    Anyway, thanks for any help!

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to name it this way:

    Code:
    <select name="Bands[]">
    If I'm not mistake, the result should be an array called $Bands containing the values of all options selected.

  3. #3
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, that was easy. THANK YOU. You are a gentleman and a scholar.


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
  •