Click here to Skip to main content
15,887,386 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: How to use 4 digit incremental serial number on mysql database using PHP on my form Pin
Jochen Arndt26-Apr-18 2:31
professionalJochen Arndt26-Apr-18 2:31 
GeneralRe: How to use 4 digit incremental serial number on mysql database using PHP on my form Pin
Member 1369186126-Apr-18 2:42
Member 1369186126-Apr-18 2:42 
QuestionHow to use PHP global processing script action to process sumbitted data and display form data entered on the text on another page Pin
Member 1369186126-Apr-18 2:13
Member 1369186126-Apr-18 2:13 
AnswerRe: How to use PHP global processing script action to process sumbitted data and display form data entered on the text on another page Pin
Richard MacCutchan26-Apr-18 2:49
mveRichard MacCutchan26-Apr-18 2:49 
QuestionHow to use a php $_SERVER['PHP_SELF'] to insert form data into Mysql database and redisplay data entered on another form Pin
Member 1369186126-Apr-18 2:11
Member 1369186126-Apr-18 2:11 
QuestionPassword Verify Pin
Valecia_cho30-Mar-18 13:32
Valecia_cho30-Mar-18 13:32 
QuestionHow to call a reply forms using php. Pin
Member 1370467720-Mar-18 20:45
Member 1370467720-Mar-18 20:45 
Questiondynamic question in php and mysql Pin
antonio_dsanchez9-Feb-18 10:24
antonio_dsanchez9-Feb-18 10:24 
Hello

I'm doing a survey web where I keep my questions in a database and then I call them when the user selects which survey will answer and my questions are shown.

This is my code where I show my questions and add raddiobuttons and textareas.


PHP
<pre><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"];
                 
            ?>
            
        
            <tr>
              <!--  <td width="50"><input type="radio" name="opcion" value="<?php echo $idres; ?>" required</td>
                <td width="470"><?php echo $texto; ?></td>-->
                <td width="50"><?php echo $idres; ?></td>
                <td width="470"><?php echo $texto; ?></td>
                <td> SI <input type="radio" name="radio<?php echo $idres; ?>" value="SI"></td>
                <td> NO <input type="radio" name="radio<?php echo $idres; ?>" value="NO"></td>
                <td><textarea name="comentarios<?php echo $idres; ?>" rows="5" cols="20">Escribe aquí tus Hallazgos</textarea></td>
                <td><textarea name="acciones<?php echo $idres; ?>" rows="5" cols="20">Escribe aquí tus Acciones Correctivas</textarea></td>
            </tr>
            <?php } ?>


and here I want to save the answers

PHP
<pre><?php
/*$opcion = $_POST["opcion"];*/
$respuesta = $_POST["radio$idres"];
$comentarios = $_POST["comentarios$idres"];
$acciones = $_POST["acciones$idres"];
require 'conexion.php';

//obtenemos la fecha del sistema
$fecha_actual = date("y-m-d");

//obtenemos el numero actual de votos para la opcion elegir
//comprovamos si $opcion no esta vacio
if(!empty($respuesta)){
    $sql = "INSERT INTO opciones(ID, idenc, valor, Accion, hallazgo, fecha) VALUES ('$respuesta' ,'$comentarios' ,'$acciones' ,'$fecha_actual')";
    $sql = mysqli_query($conexion,$sql);
}
header("Location: verEncuesta.php");
?>


I just do not know how to save the questions by id question and id survey. I suppose it's a cycle but I do not know how to structure that cycle
QuestionGet the html content from a website using php Pin
Joshin Joy17-Dec-17 20:51
Joshin Joy17-Dec-17 20:51 
AnswerRe: Get the html content from a website using php Pin
Jochen Arndt17-Dec-17 22:38
professionalJochen Arndt17-Dec-17 22:38 
GeneralRe: Get the html content from a website using php Pin
Joshin Joy18-Dec-17 20:15
Joshin Joy18-Dec-17 20:15 
GeneralRe: Get the html content from a website using php Pin
Jochen Arndt18-Dec-17 21:02
professionalJochen Arndt18-Dec-17 21:02 
GeneralRe: Get the html content from a website using php Pin
Member 1387615717-Jun-18 20:01
Member 1387615717-Jun-18 20:01 
Questionfunction to display content with php does not work as intended Pin
CHrispho15-Dec-17 9:46
CHrispho15-Dec-17 9:46 
AnswerRe: function to display content with php does not work as intended Pin
Jochen Arndt17-Dec-17 22:50
professionalJochen Arndt17-Dec-17 22:50 
QuestionChat functionality is not working when SSL is involved Pin
Member 135528281-Dec-17 17:15
Member 135528281-Dec-17 17:15 
AnswerRe: Chat functionality is not working when SSL is involved Pin
jschell5-Dec-17 12:29
jschell5-Dec-17 12:29 
QuestionPHP: using Facebook login SDK returned an error: No URL set! Pin
iucaa19-Nov-17 22:53
iucaa19-Nov-17 22:53 
QuestionPHP Getting Data From Javascript Pin
Valecia_cho23-Oct-17 13:48
Valecia_cho23-Oct-17 13:48 
AnswerRe: PHP Getting Data From Javascript Pin
Richard Deeming24-Oct-17 2:08
mveRichard Deeming24-Oct-17 2:08 
QuestionHow do I Attach acrobat pdf page to email in codeigniter? Pin
Member 1347022217-Oct-17 4:13
Member 1347022217-Oct-17 4:13 
SuggestionRe: TLDR Pin
Richard Deeming17-Oct-17 4:31
mveRichard Deeming17-Oct-17 4:31 
QuestionThinkphp 5.0 query table how the array of how to get rid of a column? And then save it to another table? Pin
micccn13-Oct-17 23:37
micccn13-Oct-17 23:37 
Questionhelp me on my php script Pin
horlartech8-Sep-17 12:03
horlartech8-Sep-17 12:03 
SuggestionRe: help me on my php script Pin
Richard MacCutchan8-Sep-17 19:24
mveRichard MacCutchan8-Sep-17 19:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.