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

    Join Date
    Jul 2000
    Posts
    1
    Rep Power
    0
    My HTML has the follwoing select statement
    <select name="number" size ="2" multiple>
    <option value="1">Red</option>
    <option value = "2">Blue</option>
    <option value="3">Green</option>
    </select>
    Whenever I make the multiple selection the last option value is displayed. Eg: if I select red and green and in my PHP when i give echo $number the value displayed is 3 which is incorrect. How do I get the correct result?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    --
    <select name="number" size ="2" multiple>
    --


    Make this as an array variable.

    <select name="number[]" size ="2" multiple>
    <option value="1">Red</option>
    <option value = "2">Blue</option>
    <option value="3">Green</option>
    </select>

    <?
    for($a=0;$a<count($number[]);$a++){
    echo $number[$a];
    }

    ?>




    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. database date selection problem
    By kidsleep in forum MySQL Help
    Replies: 0
    Last Post: January 31st, 2004, 10:50 AM
  2. WebHost Manager multiple domains under one user problem
    By Matthew Doucette in forum Dev Shed Lounge
    Replies: 9
    Last Post: January 28th, 2004, 01:56 PM
  3. Replies: 5
    Last Post: January 26th, 2004, 01:05 PM
  4. Populate multiple drop down box dependant on selection
    By maunded in forum PHP Development
    Replies: 3
    Last Post: January 21st, 2004, 12:52 AM
  5. problem with multiple submits in one .php
    By Waldo2k2 in forum PHP Development
    Replies: 2
    Last Post: January 19th, 2004, 09:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo