Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Moatazx9's avatar

i want to GET an array to laravel

i am trying to post with array like this

    @if(!empty($cat->subCategories)) @foreach($cat->subCategories as $subCategories) @php $checked = []; if(isset($_GET['category'])) { $checked = (array)$_GET['category']; } @endphp
  • {{ $subCategories->{'sub_cat_'.App::getLocale()} }} id, $checked)) checked @endif />
  • @endforeach @endif
but it return in url :&category[]=15&category[]=16
0 likes
3 replies
newbie360's avatar
Level 24

can you put the code inside

```

your code here

```

array in url &category[]=15&category[]=16 is correct

1 like
Moatazx9's avatar

but when it stores one element only as when i submit it should leave what i checked checked but it leaves one only checked

Please or to participate in this conversation.