Selectize.js does not send the whole selected option, but only the last

I have little choice of dropdown menu that works great with selectize.js. According to the form's message, it displays only the last option selected. For example, if the user selects: A, B, C in the form post var_dump ($ _ POST); only C. appears. The same thing happens with a different choice.

I looked through the documentation and searched the Internet, but could not fix it, I am sure that this is something really trivial, but so far I do not know, I do not know :(

I would really appreciate any help! Thank!

+4
source share
1 answer
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://brianreavis.imtqy.com/selectize.js/js/selectize.js"></script> 



<?php
 if(isset($_POST["save"])){
    echo '<pre>';
    print_r($_POST);
    echo '</pre>';



 }

?>

<form action="" method="post">
<label>Select Class(s)</label>
<select multiple id="classname" name="classname[]" required class="form-control">
    <option value="1">NUR</option>
    <option value="2">KG</option>
    <option value="3">PREP</option>
    <option value="4">I</option>
    <option value="5">II</option>
</select>
<label>Subjects</label>
<select multiple id="subjects" name="subjects[]" required class="form-control">
    <option value="1">English</option>
    <option value="2">EVS</option>
    <option value="3">Maths</option>
    <option value="4">Science</option>
    <option value="5">Social</option>
</select>
<label>Examinations</label>
<select multiple="multiple" id="exams" name="exams[]" required="true" class="form-control">
    <option value="1">Formative Assessment I</option>
    <option value="2">Formative Assessment II</option>
    <option value="3">Formative Assessment III</option>
    <option value="4">Formative Assessment IV</option>
    <option value="5">Annual</option>
</select>

<input type="submit" name="save" value="save" />
</form>

<script>
     $(document).ready(function () {
     $('#exams').selectize({
         hideSelected: 'true'
     });

     $('#subjects').selectize({
         hideSelected: 'true'
     });

     $('#classname').selectize({
         hideSelected: 'true'
     });
 });

</script>
+7
source

All Articles