I have a URL passing values from form checkboxes to a template. All the checkboxes are grouped with the same name= attribute. When multiple checkboxes are selected, the query string looks something like:


However, craft.request.getQuery('checkValue') returns only the last value (34567 in this case).

How can I retrieve all the values so they can be used and manipulated?

EDIT: I've corrected the naming of the checkboxes from name="checkValue" to name="checkValue[]", so now my query string looks like this:


Does that change what can be accessed using craft.request.getQuery('checkValue')?

2 Answers 2


This question is not really Craft related. Since you just don't send a valid request. You can't send one key multiple times unless you do it in an array.

The php $_GET is a simple array with all your values and you overwrite them again and again.


  • Please see edits to original post. Commented Dec 14, 2017 at 0:32

Using the corrected checkbox name name=checkValue[] the submitted values


are converted to an array. The array values can now be accessed using

{% set checkVals = craft.request.getQuery('checkValue') %}

{{ checkVals[1] }} {# outputs 23456 #}


{% for cVal in checkVals %}
    {{ cVal }}
{% endfor %}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.