Add color

This commit is contained in:
2019-07-04 09:02:37 +02:00
parent 7fa649ee13
commit 0530f4575e

View File

@@ -26,10 +26,18 @@ $questionsobj = json_decode(json_encode($questions), false);
foreach($questionsobj as $question) {
echo("<tr>");
echo("<td>$question->question</td>");
echo("<td>$question->answer0</td>");
$color = ($question->solution == 0) ? "background-color: green" : "background-color: red";
echo("<td style=$color>$question->answer0</td>");
$color = ($question->solution == 1) ? "background-color: green" : "background-color: red";
echo("<td>$question->answer1</td>");
$color = ($question->solution == 2) ? "background-color: green" : "background-color: red";
echo("<td>$question->answer2</td>");
echo("<td>$question->solution</td>");
echo("<td></td>");
echo("<td></td>");
echo("</tr>");
}