Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Multiple variables from one drop down box

    Hi, i got small problem, i have created one multiple choice drop down box!
    Now i choose multiple items from drop down box, by holding crt key, and then press submit, but it returns only last selected variable! How can i return array of selected variables? Thanks

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    the name of the selectbox should be name[] with the square brackets at the end.

    Then you can access them through $_POST['name'] which will be an array.

    eg

    Code:
    <select name="name[]" ...><option>.....</option><option>.....</option></select>
    PHP Code:
    var_dump($_POST['name']); 


  •  

    Posting Permissions

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