I have a select box that allows multiple values to be selected.
<select class="element select medium" id="songcategory" name="songcategories[]" size="5" multiple="multiple">
<option value="1---Apple">Apple</option>
<option value="2---Banana">Banana</option>
<option value="3---Orange">Orange</option>
<option value="4---Melon">Melon</option>
</select>
The form is submitted via POST. I am using the PHP code below to read all the selected options. However, I only get a SINGLE value returned - the last option selected. No array of options, zilch! Iām stumped - any ideas?
if ($_POST['songcategories']) {
foreach ($_POST['songcategories'] as $c) {
$c_array = explode("---",ucwords($c));
$categoryid = $categoryid . "," . $c_array[0];
$categoryname = $categiryname . "," . $c_array[1];
}
}