select & print multiple value from dropdown list

Posted by sandy on Stack Overflow See other posts from Stack Overflow or by sandy
Published on 2010-04-11T18:41:57Z Indexed on 2010/04/11 18:53 UTC
Read the original article Hit count: 474

Filed under:
|
|
|

hi ,

in this code how can selected multiple value from dropdown list

<?php 


include ("connect.php");

$member_id = intval($_POST['sector_list']); 


if($member_id == 0) { 
    // Default choice was selected 
} 
else { 
    $res = mysql_query("SELECT * FROM members WHERE MemberID = $member_id LIMIT 1"); 
    if(mysql_num_rows($res) == 0) { 
        // Not a valid member 
    } 
    else { 
        // The member is in the database 
    } 
} 
?> 

<form method="post" action=""> 
    <input type="hidden" name="sector" value="sector_list">  
    <select name="sector_list" class="inputstandard" multiple="multiple">  
        <option value="0">send to</option> 
        <?php  
        $result = mysql_query('SELECT * from members') or die(mysql_error());   

        while ($row = mysql_fetch_assoc($result)) { 
            echo '<option value="' . $row['MemberID'] . '">' . $row['MemberName']. '</option>';  
        } 
        ?>  
    </select> 
</form> 

assume the drop down list contain on (a,s,d,f,g,h,j,)

users selects multiple value ( a,s,j)

output = a,s,j not only j

???

© Stack Overflow or respective owner

Related posts about dropdown

Related posts about list