Thread: select form

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    11
    Rep Power
    0
    Hi,

    in my html-File i have a select form:

    select name="Categories" size="10" multiple
    option value="id1" Chinese /option
    option value="id3" Main dish /option
    option value="id2" Salad /option
    option value="id4" Dessert /option
    /select

    it's a multiple form so the user can select several statements.

    My question: how can i access this form in php and find out which options were selected?

    Thanks,
    Chris.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    Hi Chris,

    Name the select element "Categories[]" instead of "Categories"

    Then in your PHP script, you will have a variable called $Categories that will be an array containing all of the selected items:

    while (list ($iKey, $sVal) = each ($Categories)) {
      if ($sVal == "id2") {
        ...
      }
    }

    -- Christopher

    [This message has been edited by scollo (edited April 28, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    11
    Rep Power
    0
    Hi Christopher,

    thanks for your help!

    Christoph.

Similar Threads

  1. Enable form on radio button select
    By (sic)master in forum HTML Programming
    Replies: 2
    Last Post: February 8th, 2004, 05:19 PM
  2. Avoid form resubmission when REFRESH clicked
    By rahulgup in forum ASP Programming
    Replies: 0
    Last Post: February 5th, 2004, 02:21 PM
  3. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 07:40 PM
  4. sending form field data
    By bellcom in forum PHP Development
    Replies: 1
    Last Post: January 19th, 2004, 04:39 PM
  5. form creation using php
    By emzyme in forum PHP Development
    Replies: 4
    Last Post: January 15th, 2004, 07:23 AM

IMN logo majestic logo threadwatch logo seochat tools logo