I need to keep selected the options users choose in a multiple select menu. This is the code I have so far, but still doesnt’ work. Thank you for your help!
<select name="cb_estatura2[]" size="6" multiple="multiple" class="inputbox" id="cb_estatura2">
<?php
$height = array("57","58","59","60");
$choosen_height = $_GET['cb_estatura2'];
for ($i=0;$i<count($height);$i++)
{
$selected = ($height[$i] == $choosen_height[$i] ? 'selected="selected"' : '');
echo "<option value='$height[$i]' $selected>$height[$i]</option>";
}
?>
</select>
The one thing that should work would be this:
This should work, just for the fact that the
$_GET['cb_estatura2']doesn’t populate like the$heightarray. Could be wrong, haven’t tested it.