Colleagues. I have the following code:
$array = array("A","B","C","D","E");
echo "<div style='font-size: 18px; text-align: left: font-weight: bold'>Olá, ".$nome."</div>";
echo "<br>";
echo "<div style='width: 100%; background-color:#0070C0; color: #FFF; text-align: center; font-size: 16px; font-weight: bold'>".$xml->avaliacao->disciplina['nome']."</div>";
echo "<br>";
echo "<div style='width: 100%; background-color:#eaeaea; text-align: center; font-size: 16px; font-weight: bold'>".$xml->avaliacao['segmento']. " Série.: " .$xml->avaliacao['serie']."</div>";
echo "<br><br>";
echo "Preencha abaixo as questões:";
echo "<br><br>";
$c = 1;
for($contar = 0; $contar < $xml->avaliacao['questoes']; $contar++){
echo "<div style='width: 100%; background-color:#FFFBA6; text-align: left; color: #0070C0; font-weight: bold'> QUESTÃO " .$c.":</div>";
echo "<br>";
foreach($array as $opcao) {
echo $opcao . ": <input type='radio' name='respostas[".$contar."]' value='".$opcao."' ".$checked.">" . "<br>";
}
$c++;
}
Through an XML file, I bring the questions from a file to the user to mark the answers. To get the answers, I'm doing it this way:
foreach($xml->avaliacao->disciplina->questao as $listar => $valor) {
$numero = $valor["numero"];
echo $numero;
$respostas = $valor->resposta;
if($_POST["respostas"][$c] == $respostas){
$valor = "1";
$somar[0] = $cc++;
$respostasC = str_pad($_POST["respostas"][$c], 2);
$respostasCorretas = implode(', ', explode(' ', $respostasC));
echo "Corretas " .$respostasCorretas;
echo "<br>";
}else{
$valor = "0";
$somarE[0] = $cc++;
$respostasE = str_pad($_POST["respostas"][$c], 2);
$respostasErradas = implode(', ', explode(' ', $respostasE));
echo "Erradas " .$respostasErradas;
echo "<br>";
}
$c++;
//$respostas = array("",$_POST["respostas"][$c]);
}
So far it works perfectly, but if there are 20 questions, it only lists the top 10. Can you tell me why this happens?