Level 73
Not really sure what it is you are trying to accomplish but when it comes to radio buttons only one can be selected in each group.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
can someone help me on how to do loop with radio button.. this is my code and the result is 5 radio button displayed per row but only one is being chosen on all rows.. here is the code
@foreach($books as $book)
<tr>
<td align="justify"><h3 class="semi-bold">{{$book->name}}: {{$book->description}}</h3></td>
<td width="20%"></td>
@for($i=1; $i <= 5; $i++)
<td width="4%"><input type="radio" name="$i" value="$i" /><label>{{ $i }}</label></td>
@endfor
</tr>
@endforeach
So I think the name of the element should be string in the first place. Right now you have the id of the item in there while I would expect something like this
Form::radio('book[' . $book->id . ']', 1, false, ['check' => 'icheck'])
The rest of the code looks pretty good to me!
Please or to participate in this conversation.