case '3': respuesta_upd($_POST['id1'], $_POST['Alt1'], 0, $_GET['pregunta']); respuesta_upd($_POST['id2'], $_POST['Alt2'], 0, $_GET['pregunta']); respuesta_upd($_POST['id3'], $_POST['Alt3'], 1, $_GET['pregunta']); break; default: break; } echo "<div align=center><h1>GUARDANDO, ESPERA...\n <meta http-equiv='Refresh' content='2;url=ficha_cuestionario.php?cuestionario=" . $_GET["cuestionario"] . "'></font></h1></div>"; } } else { echo "<div align=center><h1>EDITAR PREGUNTA</h1><br>"; echo "<form name=form action=" . $_SERVER['PHP_SELF'] . "?cuestionario=" . $_GET["cuestionario"] . "&pregunta=" . $_GET['pregunta'] . " method='post'>"; echo "<table>"; echo "<tr><th><h4>Pregunta</th><td><input type='text' name=pregunta value=" . $pregunta['pregunta'] . " required size='80'></td></tr>"; $respuestas = respuestas_consultar('pregunta', $_GET['pregunta']); echo "<tr><th><h4>Alternativa 1</th><td><input type='text' name=Alt1 value='" . $respuestas[0]['respuesta'] . "'' required size='80'> "; echo "<input type='hidden' name='id1' value='" . $respuestas[0]['id_respuesta'] . "'>"; if ($respuestas[0]['correcta'] == 1) { echo "<input type='radio' name='Correcta' value='1' checked>"; } else { echo "<input type='radio' name='Correcta' value='1'>"; } echo "</td></tr>"; echo "<tr><th><h4>Alternativa 2</th><td><input type='text' name=Alt2 value='" . $respuestas[1]['respuesta'] . "' required size='80'>  "; echo "<input type='hidden' name='id2' value='" . $respuestas[1]['id_respuesta'] . "'>"; if ($respuestas[1]['correcta'] == 1) { echo "<input type='radio' name='Correcta' value='2' checked>"; } else { echo "<input type='radio' name='Correcta' value='2'>"; }
include "cabecera.php"; include "BL/cuestionarios_funciones.php"; include "BL/preguntas_funciones.php"; include "BL/respuestas_funciones.php"; $cuestionario = cuestionario_consultar("id", $_GET["cuestionario"]); $cuestionario = $cuestionario[0]; $preguntas = consultar_preguntas('cuestionario', $_GET["cuestionario"]); $total = count($preguntas); echo "\n<div id='maincontent' class='bodywidth clear' align='center'>\n <h2>Ficha del cuestionario " . $cuestionario['cuestionario'] . " </h2><br>\n <h3>Total de preguntas del cuestionario: " . $total . " </h3>\n <a href=ficha_nueva_pregunta.php?cuestionario=" . $cuestionario['id_cuestionario'] . "><br>\n <img src=images/add.png width=50></a><h3>Añadir Pregunta</h3>"; echo "<table>\n <thead>\n <tr>\n <th><h3>Preguntas</h3></th>\n <th width='10%'><h3>Opciones</h3></th>\n </tr>\n </thead>\n <tbody>"; if (is_array($preguntas)) { foreach ($preguntas as $pregunta) { echo "<tr>"; echo "<td><h3>" . $pregunta['pregunta'] . "</h3><br>"; $respuestas = respuestas_consultar('pregunta', $pregunta['id_pregunta']); if (is_array($respuestas)) { echo "<ul>"; foreach ($respuestas as $respuesta) { if ($respuesta['correcta'] == 1) { echo "<li><mark>" . $respuesta['respuesta'] . "</mark></li><br>"; } else { echo "<li>" . $respuesta['respuesta'] . "</li><br>"; } } echo "</ul>"; } else { echo "Sin respuestas"; } echo "</td>"; echo "<td><h4><a href=ficha_pregunta_editar.php?pregunta=" . $pregunta['id_pregunta'] . "&cuestionario=" . $_GET["cuestionario"] . ">\n <img src=images/pencil.png width=20></a>\n <a href=ficha_pregunta_borrar.php?pregunta=" . $pregunta['id_pregunta'] . "&cuestionario=" . $_GET["cuestionario"] . "> \n <img src=images/cross.png width=20></a> </h4></td>";