Radio button not saved on the bench

Asked

Viewed 22 times

0

I can’t seem to do the radio button chosen to go to the bank

<form method="post" action="functions/modalQuiz.php" enctype="multipart/form-data">
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                     aria-hidden="true">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel">Quiz Brutus</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>

                            <div class="modal-body">
                                <h3><?= $col2['pergunta']; ?></h3>
                                <input type="hidden" name="pergunta" value="<?= $col2['pergunta']; ?>">
                                <hr>
                                <label for="radio"><input type="radio" id="radio" name="resposta" value="<?= $col2['resposta1']; ?>"> <?= $col2['resposta1']; ?></label>
                                <hr>
                                <label for="radio2"><input type="radio" id="radio2" name="resposta" value="<?= $col2['resposta2']; ?>">  <?= $col2['resposta2']; ?></label>
                                <hr>
                                <label for="radio3"><input type="radio" id="radio3" name="resposta" value="<?= $col2['resposta3']; ?>">  <?= $col2['resposta3']; ?></label>
                            </div>
                            <div class="modal-footer">
                                <button type="submit" class="btn btn-primary" data-dismiss="modal">Salvar</button>
                                <button type="submit" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>

And this is the PHP who will receive him.

include("conexao.php");

$pergunta = $_POST['pergunta'];
$resposta = $_POST['resposta'];

$insert = "INSERT INTO modalquiz(pergunta, resposta) VALUES ('$pergunta','$resposta')";
mysqli_query($conn, $insert);
//header("Location: ../index.php");
  • Have you checked your server’s error logs? Could you put the last few lines of it in the question?

  • Ola Anderson, I found the problem, a modal Dismiss was canceling the operation.

  • Problem now is that I need to return all modals, finishing the first needs to appear the second, but it comes back with the header of . php in which I sent the form

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.