dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Get The Value of Multiselect Listbox

  1. #1
    Join Date
    Apr 2006
    Posts
    41

    Exclamation Get The Value of Multiselect Listbox

    Hello friends,

    I am having a one list box on one form.
    in which u can select multiple items,
    after submiting i want to get the values selected on that Listbox
    on submitted page.
    so how can i get that?

    -- JD

  2. #2
    Join Date
    Apr 2006
    Posts
    41
    here is the code on form 1.

    <tr>
    <td>Finish</td>
    <td><select multiple size="3" name="finish">
    <option value>n/a
    <option value="D">Dull
    <option value="M">Matte
    <option value="P">Polished</option>
    </select>
    </td>
    </tr>

  3. #3
    Join Date
    Sep 2006
    Posts
    708
    I m looking for an answer for the same question...any one to help us?


    Thanx

  4. #4
    Join Date
    Aug 2007
    Location
    Leeds, Yorkshire, England
    Posts
    387
    finish needs to be an array i.e. finish[]


    PHP Code:
    <?php
    foreach($_POST['finish'] as $a => $b)
      echo 
    "$a $b<br />";
    ?>


    <form method="post">
    <select multiple size="3" name="finish[]">
    <option value="">n/a
    <option value="D">Dull
    <option value="M">Matte
    <option value="P">Polished</option>
    </select>
    <input type="submit">
    </form>

  5. #5
    Join Date
    Sep 2006
    Posts
    708
    Thanx man.

  6. #6
    Join Date
    Jul 2007
    Location
    Cracow
    Posts
    78
    Code:
    <form action="" method="post">
    <select multiple size="3" name="finish[]">
    <option value>n/a</option>
    <option value="D">Dull</option>
    <option value="M">Matte</option>
    <option value="P">Polished</option>
    </select>
    <input type="submit" value="OK"/>
    </form>
    <?php
    var_dump($_POST);
    ?>
    Remember abount ending name of select with [].

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles