Answer the question
In order to leave comments, you need to log in
How to display random questions on page refresh?
Hi all.
There is a list
<div class="b-question">
<p>Первый вопрос</p>
<ul>
<li><label><input name="q1" type="radio" value="a">Первый ответ</label></li>
<li><label><input name="q1" type="radio" value="b">Второй ответ</label></li>
<li><label><input name="q1" type="radio" value="c">Третий ответ</label></li>
<li><label><input name="q1" type="radio" value="d">Четвертый ответ</label></li>
</ul>
</div>
Answer the question
In order to leave comments, you need to log in
If you want to mix at the front, then here is the solution to your problem.
upd. And also they asked .
upd 2. In general, learn to google . :)
$перемешанные = shuffle($массив_с_вопросами);
php.net/manual/en/function.shuffle.php
So answers or questions are needed randomly? although the essence does not change.
There is an array of answers/questions retrieved from the database.
$answers = [1,2,3,4,5];
$shuffledAnswers = shuffle($answers);
echo $shuffledAnswers[0];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question