I am using the Jquery Multiselect Widget to have a dropdown with the mulitselect parameter. I populate the drop-down list with data from the MySql database. I could not pass multiple values to the php file in $ _POST.
My HTML and PHP code for Multiselect DropDown.
<form id="intermediate" name="inputMachine" method="post"> <select id="selectDuration" name="selectDuration" multiple="multiple"> <option value="1 WEEK" >Last 1 Week</option> <option value="2 WEEK" >Last 2 Week </option> <option value="3 WEEK" >Last 3 Week</option> </select> <?php <select id="selectShift" name="selectShift" multiple="multiple"> <?php while($fetch_options = mysql_fetch_array($data)) { <option name="selected_ids[]" id ="<?php echo $fetch_options['id']; ?>" value="<?php echo $fetch_options['name']; ?>"><?php echo $fetch_options['name']; ?></option> <?php } ?> </select>
Here I fill in the Shift drop-down menu in the Multiselect drop-down list. If I select more than one shift, I could not get all these selected values in php. instead, I only get the last selected value.
I want to do something like this.
$shiftarraycalc = array(); foreach ($_POST['selectShift'] as $key => $value) { array_push($shiftarraycalc,$value); }
but does not work.
I do not know how to get multiple values in $ _POST.
Allen source share