Colleagues.
I have the following code:
$array = array("A","B","C","D","E");
for($contar = 1; $contar <= 9; $contar++){
echo "Pergunta " . $contar . "<br>";
foreach($array as $opcao) {
echo $opcao . ": <input type='radio' name='respostas[".$contar."]' value='" . $opcao ."'>" . "<br>";
}
}
And I'm picking up values like this:
for($contar = 1; $contar <= 9; $contar++){
foreach($respostas as $resposta){
if(!empty($resposta[$contar])){
$valor = "1";
}else{
$valor = "0";
}
}
}
}
I need to make the fields that are not selected receive a value of 0, but when I fill in the fields, it triples and is not in the correct order.