I have a select option form field with multiple="true" attribute inside a while loop. If the select option should be multiple chosen we should put a square bracket like [] to the name.
Ref: How to get multiple selected values of select box in php?
while($rowdocmap=$resdocmap->fetch_object()){ <select class="form-control" name="selMonths[]" multiple="multiple" required="required">
<?php $lsmonths=explode(",", $rowdocmap->DM_Months);
for ($m=1; $m<=12; $m++) {
$month = date('F', mktime(0,0,0,$m, 1, date('Y')));
?>
<option value="<?php echo sprintf("%02d", $m); ?>" <?php if(in_array($m, $lsmonths)) echo 'selected="selected"'; ?>><?php echo $month?></option> <?php } ?> </select>
}
In this type of scenario how can i get values from each select box array