Receive data from a modal/bootstrap registration form in php

Asked

Viewed 316 times

1

I have the following index.html file in which you have 2 forms: login and the second one in modal for the registration. But in the registration modal, the data entered by the user are not received in the file 'registration.php'

Follows the code:

      <!-- modal form cadastro -->
      <!-- Modal -->
      <div class="modal fade" id="myModal" role="dialog">
          <div class="modal-dialog">
              <!-- Modal content-->
              <div class="modal-content">
                  <div class="modal-header">
                      <h3 class="modal-title" style: font-size = "14px">Cadastre-se</h3>
                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                  </div>

                  <div class="modal-body">
                      <h5>Preencha os campos abaixo:</h5>

                      <form method="post" action="php/cadastro.php">
                        <div class ="form-group">
                          <label id "nome_id">Nome:</label>
                          <input type="nome" class="form-control" name ="nome"required style="min-width:310px;">
                          <!--------------------------------------------->
                            <label id ="email_id">E-mail:</label>
                            <input type="email" class="form-control" name="email"required style="min-width:310px;">
                              <!--------------------------------------------->
                            <label id ="senha_id">Senha:</label>
                            <input type="password" class="form-control" name="senha"required style="min-width:310px;">
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary" data-dismiss="modal" value ="btn-cadastra">Continuar</button>
                        </div>
                      </form>
                  </div>
              </div>
          </div>
      </div>

The file 'cadastra.php':

<?php

if(isset($_POST['btn-cadastra'])) {
  $nome = $_POST['nome'];
  var_dump($nome);

  $email = $_POST['email'];
  var_dump($email);

  $senha = $_POST['senha'];
  var_dump($senha);
}
?>
  • appears any error? Already tried to put on the page cadastra.php only one var_dump($_POST) at the beginning of everything?

  • I did it! I took the date-Dismiss and it worked!

No answers

Browser other questions tagged

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