php - Capturing multiple value from dropdown list generated from database
887
I am having problem to capture multiple value from drop-down list which is generated from database.I have to capture multiple value and that also has to be saved in database.Its only capturing the last selected value id insted of all and saving that value to database. here is my code
<?php
include("config.php");
$result2 = mysql_query("SELECT Emp, ed FROM pd WHERE manemail = '$mai'");
echo "<select name='allo' multiple style='width:163px;'>";
while($row2 = mysql_fetch_array($result2))
{
$emp=$row2['Emp'];
$ed=$row2['ed'];
echo "<option value='".$ed."' name='" .$ed. "' >" .$emp. " </option>";
}
echo "</select>";
?>
Answer
Solution:
Add brackets "[ ]" to your select's name:
Then, you can have all selected values in PHP, like this: