3

I have the next multiple field in my html view:

<select multiple="multiple" name="search[cpuUsage[]]"
    id="search_cpu_usage"
    class="form-control">
    {% for statu in status %}
        <option value="{{ statu }}">{{ statu }}</option>
    {% endfor %}
</select> 

i need all possible values that user select, and i try save in search[cpuUsage[]], but this not work because php only get the last selected value. if i use only cpuUsage[] without search[] works perfectly.

For send to server i use jquery.serialice.

any idea of how do for work search[cpuUsage[]]

1
  • cpuUsage[] is an array already why do you need the search array? Commented May 9, 2018 at 10:32

1 Answer 1

6

You need to have name attribute as an array

So change

name="search[cpuUsage[]]"

To:-

name="search[cpuUsage][]" //or name="search[]" or name="cpuUsage[]"

And you are good to go

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.