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

    Join Date
    Jun 2000
    Posts
    3
    Rep Power
    0
    Hi all,

    I have a form with a selection list such as:

    <select name="name" multiple>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
    </select>

    I'm wondering...when the form is submitted, and all three options are selected, how would I access these values ($name) with php? Is it stored as an array?

    Any help would be GREATLY appreciated!!

    Thanks.

  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    When using a MULTIPLE option form element, you should use an array identifier in the name:

    <select name="name[]" multiple>
    <option ....

    Then in the action script the selected values will be in the array $name starting with index 0. You can get the number of selected options with the count() function:

    <?
    for ($i=0;$i<count($name);$i++)
    {
    print "$name[$i]<br>n";
    }
    ?>

Similar Threads

  1. exit tag preventing html from precessing completely
    By jshain in forum PHP Development
    Replies: 1
    Last Post: January 27th, 2004, 11:13 AM
  2. How to get client email??Help plz
    By Gecko22 in forum ASP Programming
    Replies: 12
    Last Post: January 22nd, 2004, 02:40 PM
  3. not returning records when it should
    By aliaga61 in forum ASP Programming
    Replies: 3
    Last Post: January 16th, 2004, 11:57 AM
  4. 'Object required' error
    By aliaga61 in forum ASP Programming
    Replies: 1
    Last Post: January 16th, 2004, 09:48 AM
  5. Replies: 6
    Last Post: December 21st, 2003, 05:24 PM

IMN logo majestic logo threadwatch logo seochat tools logo