How to keep the radio button selected if the page is refreshed
It is very easy with PHP. You can use isset()
inside the HTML tag for the condition to check or uncheck.
isset($a[0]) ? 'checked' : ''
Use this in the radio button
<input type="radio" name="jawaban<?php echo $row->id_quiz; ?>[]" value="<?=$a[0]?>" <?= isset($a[0]) ? 'checked' : ''?> >
You can maintain your radio values into cookies. But maintaining cookies for radio values is very difficult or you can use local storage.
Some references are given below to use cookies and local storage.
You can use LocalStorage:
window.localStorage.setItem('user', 'jawaban'); //Set or savewindow.localStorage.getItem('user'); //get back the saved value