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

altoin's avatar

Pagination and Radio Button Value

Hello everyone, i have a simple quiz application that displays 1 question per-page to users. Everything works for now, but i noticed that once a user navigates away from a page, the radio button on the page is unchecked. Is there're a way to retain radio button checked value till the form is submitted. here is my code.

                @foreach($question as $q)
                     <div>

                         <p>{{$q->question}}</p>


                             @foreach($q->answers['option'] as $key=>$val)
                                 <div class="radio">
                                     <label><input type="radio" name="{{$q->id}}_answer">{{$val}}</label>
                                 </div>
                             @endforeach

                     </div>

                    @endforeach
                    {{$question->links() }}
                 </form>
0 likes
2 replies
altoin's avatar

@Snapey Than You for the response, I'd take a look at laraquiz too.

Please or to participate in this conversation.