Level 104
%5B and %5D are percent-encoding of the [ and ] array brackets; generally I would prefer to either name the checkbox field differently; or build the query parameter as a comma-separated list, e.g. ?subcategory=1,2,3
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this code and it is sorting correctly now. But the URL will add subcategory%5B%5D=1(id). How can I get rid of %5B%5D from the URL
<form action="{{ route('product.list',[$slug]) }}" name="subcatform" method="GET">
@foreach($subcategories as $subcategory)
<p><input type="checkbox" name="subcategory[]"
value="{{$subcategory->id}}" class="mr-2"
@if(isset($filterSubCategories))
{!!in_array($subcategory->id,$filterSubCategories)?'checked ="checked" ':''!!}
@endif
>{{$subcategory->name}}</p>
<!--end foreach-->
@endforeach
<input type="submit" value="Filter" class="btn btn-info">
</form>
%5B and %5D are percent-encoding of the [ and ] array brackets; generally I would prefer to either name the checkbox field differently; or build the query parameter as a comma-separated list, e.g. ?subcategory=1,2,3
Please or to participate in this conversation.