Question

I want to use a multiple-select field in jQuery-Mobile. However only the last selected value is sent to the server. This is my Code:

     <select name="myValues"
     data-native-menu="false" data-mini="true" multiple="multiple">
        <option>Select one or more</option>
     <?php 
     foreach ($propPosValues AS $posValue) {    
             <option value="<?= $field['Id'] ?>"><?= $field['Value'] ?></option>
     <?php } ?>

    </select>

Don't bother about the php-code. It actually works. The UI shows a multiple-selects that opens in another window. But only the last selected-Value is sent to the server. But I obviously want all of them.

Any suggestions?

Was it helpful?

Solution

The name-tag needs to be name="myValues[]". The brackets "[]" indicate, that this is an array of values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top