radio buton and textarea in a dynamic questionnaire

0

I am creating a dynamic questionnaire with MYSQL and PHP 7. In a page I create my questions and my questionnaire and I keep them in MYSQL and in another page I show them making a call to the database to bring me the questions.

only that I have a problem, when calling the questions I want that each question sends me 2 radiosbutton and 2 textarea.

which I do it in the following way.

 <table>
            <tr>
                <!--Mostramos el titulo de la encuesta-->
                <td colspan="2"> <h3><?php echo $titulo; ?></h3></td>
            <input type="hidden" name="id" value="<?php echo $id; ?>">
            </tr>
            <?php
            //consulta que captura el texto , id de la tabla respuestas
            $sql = "SELECT texto,id FROM respuestas WHERE idenc='$id'";
            $sql = mysqli_query($conexion,$sql);
            //ahora recorremos los datos texto, id que estan vinculadas a la cuenta seleccionada
            while ($row = mysqli_fetch_array($sql)){
                $texto = $row["texto"];
                $idres = $row["id"];
               
       //añiado los radiobuttons y los textarea          
            ?>
            <tr>
                <td width="50"><?php echo $idres; ?></td>
                <td width="470"><?php echo $texto; ?></td>
                <td> SI <input type="radio" name="SI" value="<?php echo $idres; ?>"></td>
                <td> NO <input type="radio" name="NO" value="<?php echo $idres; ?>"></td>
                <td><textarea name="comentarios" rows="5" cols="20">Escribe aquí tus Hallasgos</textarea></td>
                <td><textarea name="comentarios" rows="5" cols="20">Escribe aquí tus Acciones Correctivas</textarea></td>
                
           </tr>
            <?php } ?>
            <tr>

only that this way only allows me to answer two questions and not all the questions of the survey

    
asked by antonio sanchez 08.02.2018 в 15:30
source

1 answer

0

What happens is that you have exchanged the value and name attributes

name is the name of the field, as there are only names if and not only will it allow you to answer 2 times

in name you must place the idres and value of each field is Yes or No depending on the value of the radio button

    
answered by 08.02.2018 / 15:47
source