SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    canada
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question pass multiple values from a select list?

    Hi there,

    I have a select list, where user can select multiple values, and submit
    the form. However, it seems I can only get the ONE value from the
    select list, not multiple values. For example,

    <form ...>
    ...
    <select name=fruit size=5 multiple>
    <option value=apple>Apple</option>
    <option value=orange>Orange</option>
    <option value=grape>Grape</option>
    <option value=banana>Banana</option>
    ...
    </select>
    ...

    If user select "Apple" and "Grapde", I only got "Grape" as the value
    for $fruit, not "Apple,Grape". How can I make this working? Do I
    miss some very basic stuff here? Another question, if multiple values
    are selected, the return variable $fruit is an array or some sort of
    string?

    Many thanks in advance.

    Lana

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change the name of the <select to fruit[], you will then get an array in PHP of all the values the user selected.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


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
  •