I know there are similar posts on this topic but i didn't find my answer from there.
An online MCQ exam test. Number of questions in the page is variable. 4 options for every MCQ(multiple choice question).
<input type="radio" name="my" value="1"/>
<input type="radio" name="my" value="2"/>
<input type="radio" name="my" value="3"/>
<input type="radio" name="my" value="4"/>
Examniee has to select one for each question. On page refresh, deselection takes place. How to retain the checked values on refresh - javascript, jquery or what? Details necessary. Scripting language is php.
Basic html:
<input type="radio" name="my" selected="selected" value="1" />
via PHP:
for ($i = 1; $i <= 4; $i++) {
$sel = ($i == $some_way_to_tell_which_to_select) ? ' selected="selected"' : '';
echo <<<EOL
<input type="radio" name="my"$sel value="$i" />
EOL;
}
Seems that you want an auto save form's data feature. There are several jquery plugins for this. Recently I used: http://rikrikrik.com/jquery/autosave/
Only javascript can give you this kind of functionality with data still not parsed in the server side.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.