Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top