0
how to take the value of inputs that comes by array because it is the form is fed by the client follows the form code, hence how many questions he wants in my poll system, and creates the answers.. wanted to know how to take the value of the fields of the questions he answered. and register in a table..
$consulta2 = (" SELECT *
FROM perguntas
WHERE id_feedback = '$id'
ORDER BY id ASC
LIMIT 0 , 30 ");
$resultado = mysql_query($consulta2) or die("Erro no SQL: ".mysql_error());
while($lista = mysql_fetch_array($resultado)){
$id = anti_injection($lista['id']);
$validacao_campo = anti_injection($lista['$validacao_campo']);
$pergunta_principal = anti_injection($lista['$pergunta_principal']);
$primeira_opcao = anti_injection($lista['$primeira_opcao']);
$segunda_opcao = anti_injection($lista['$segunda_opcao']);
$terceira_opcao = anti_injection($lista['$terceira_opcao']);
$quarta_opcao = anti_injection($lista['$quarta_opcao']);
?>
<fieldset>
<br>
<h2 class="fs-title"> <?php echo $lista['pergunta_principal']; ?> </h2>
<input type="text" name="pergunta_principal" value="<?php echo $lista['pergunta_principal']; ?>" >
<br>
<h3 class="fs-subtitle"></h3>
<?php
if (!empty($lista['primeira_opcao'])){
echo $lista['primeira_opcao'] . "<input type='radio' value='" . $lista['primeira_opcao'] . "' name='" . $lista['validacao_campo'] . "' > ";
}
if (!empty($lista['segunda_opcao'])){
echo $lista['segunda_opcao'] . "<input type='radio' value='" . $lista['segunda_opcao'] . "' name='" . $lista['validacao_campo'] . "' > ";
}
if (!empty($lista['terceira_opcao'])){
echo $lista['terceira_opcao'] . "<input type='radio' value='" . $lista['terceira_opcao'] . "' name='" . $lista['validacao_campo'] . "'> ";
}
if (!empty($lista['quarta_opcao'])){
echo $lista['quarta_opcao'] . "<input type='radio' value='" . $lista['quarta_opcao'] . "' name='" . $lista['validacao_campo'] . "' > ";
}
?>
<br><br>
<input type="button" name="previous" class="previous action-button" value="Anterior" />
<input type="button" name="next" class="next action-button" value="Proxima" />
</fieldset>
<?php } ?>
What comes from where? The first line of the question is very confusing.
– user28595
<br> <H2 class="Fs-title"> <?php echo $list['main question']; ? > </H2> <input type="text" name="inquiri_principal" value="<? php echo $list['inquiri_main']; ? >" > <br>
– João Lucas Chaves
That’s where I pass it. this piece of code keeps repeating, if the user registers another question with options it repeats .. wanted to know how I got each question and the answer selected. and send by email or register in the database
– João Lucas Chaves