Answer the question
In order to leave comments, you need to log in
How do I shuffle the items that I take from the database?
There is a testing system, everything works, but I would like to mix the answer options, how can I do this?
<div class="content">
<?php if( isset($test_data) ): ?>
<p>Всего вопросов: <?=$count_questions?></p>
<span class="none" id="test-id"><?=$test_id?></span>
<div class="test-data">
<?php foreach($test_data as $id_question => $item): //получаем каждый конкретный вопрос + ответы. ?>
<div class="question" data-id="<?=$id_question?>" id="question-<?=$id_question?>">
<?php foreach($item as $id_answer => $answer): //Проходимся по массиву вопрос ответы. ?>
<?php if( !$id_answer ): //Выводим вопрос ?>
<p class="q"><?=$answer?></p>
<?php else: //Выводим варианты ответов ?>
<p class="a">
<input type="radio" id="answer-<?=$id_answer?>" name="question-<?=$id_question?>" value="<?=$id_answer?>">
<label for="answer-<?=$id_answer?>"><?=$answer?></label>
</p>
<?php endif; //$id_answer ?>
<?php endforeach ?>
</div><!-- .question -->
<?php endforeach; //test_data ?>
</div> <!-- .test_data -->
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question