Send modal form on a normal form

0

Ihavearegistrationformandithasalink(alreadyhasanaccount>)thatexecutesanotherform(login),thisbeingamodal.Myproblemisthatwhentryingtosubmit/submitthemodalform,itrequiresthatyoufillinthefieldsofthenormalform(cadastre)thatwasopen,becausethisregistrationformrequiressomemandatoryfields.Howtoproceed?

formcadastro.php

<divclass="container">
    <div class="row espacamento">
        <div class="col-md-8 col-md-offset-2">
            <form role="form" method="POST" action="confirmacao.php">
                <fieldset>
                    <div class="form-group col-md-12">
                        <legend>Cadastro</legend>
                    </div>
                    <div class="form-group col-md-12">
                        <label for="first_name">Nome completo
                        </label>
                        <input type="text" class="form-control" name="nome" id="name" placeholder="Nome completo" required>
                    </div>
                    <div class="form-group col-md-6">
                        <label for="first_name">Data de Nascimento
                        </label>
                        <div class='input-group date'>
                            <input type='text' name ="datanasc" id="datanasc" class="form-control datanasc"/>
                            <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>
                    </div>
                    <div class="form-group col-md-12">
                        <label for="first_name">Endereço
                        </label>
                        <input type="text" class="form-control" name="endereco" id="endereco" placeholder="Endereço" required>
                    </div>
                    <div class="form-group col-md-6">
                        <label>Cidade</label>
                        <input type="text" class="form-control" name="cidade" placeholder="">
                    </div>
                    <div class="form-group col-md-6">
                        <label for="country">UF</label>
                        <select class="form-control" name="estado" id="country">
                            <option value="estado">Selecione o Estado</option> 
                            <option value="Acre">Acre</option> 
                            <option value="Alagoas">Alagoas</option> 
                            <option value="Amazonas">Amazonas</option> 
                            <option value="Amapá">Amapá</option> 
                            <option value="Bahia">Bahia</option> 
                            <option value="Ceará">Ceará</option> 
                            <option value="Distrito Federal">Distrito Federal</option> 
                            <option value="Espírito Santo">Espírito Santo</option> 
                            <option value="Goiás">Goiás</option> 
                            <option value="Maranhão">Maranhão</option> 
                            <option value="Mato Grosso">Mato Grosso</option> 
                            <option value="Mato Grosso do Sul">Mato Grosso do Sul</option> 
                            <option value="Minas Gerais">Minas Gerais</option> 
                            <option value="Pará">Pará</option> 
                            <option value="Paraíba">Paraíba</option> 
                            <option value="Paraná">Paraná"</option> 
                            <option value="Pernambuco">Pernambuco</option> 
                            <option value="Piauí">Piauí</option> 
                            <option value="Rio de Janeiro">Rio de Janeiro</option> 
                            <option value="Rio Grande do Norte">Rio Grande do Norte</option> 
                            <option value="Rondônia">Rondônia</option> 
                            <option value="Rio Grande do Sul">Rio Grande do Sul</option> 
                            <option value="Roraima">Roraima</option> 
                            <option value="Santa Catarina">Santa Catarina</option> 
                            <option value="Sergipe">Sergipe</option> 
                            <option value="São Paulo">São Paulo</option> 
                            <option value="Tocantins">Tocantins</option> 
                        </select>
                    </div> 
                    <div class="form-group col-md-6">
                        <label>Email</label>
                        <input type="email" class="form-control" name="email" placeholder="E-mail" required>
                    </div>

                    <div class="form-group col-md-6">
                        <label>Telefone</label>
                        <input type="tel" class="form-control telefone" id="telefone" name="tel"  maxlength="15" autocomplete="off" onkeyup="mascara2(this, mtel2);" required>
                    </div>
                    <div class="form-group col-md-6">
                        <label for="password">Senha</label>
                        <input type="password" class="form-control" name="senha" id="password" placeholder="Senha" required>
                    </div>
                    <div class="form-group col-md-6">
                        <label for="password">Confirme a senha</label>
                        <input type="password" class="form-control" name="repetesenha" id="repetir_senha" placeholder="Confirme sua Senha..."
                               oninput="validaSenha(this)" required>            
                    </div>
                </fieldset>
                <!--CHAMANDO O MODAL-->
                <div class="form-group">
                    <div class="col-md-12">
                        <button type="submit" name="enviar" class="btn corbotao">Cadastrar</button>
                        <?php include 'login-conta.php';?>                      
                    </div>                  
                </div>
            </form>
        </div>
    </div>
</div>

login-account.php (modal)

    <div class="modal fade" id="modal-mensagem">
    <div class="modal-dialog">
        <div class="modal-content espacamento">
            <div class="modal-header">
                <button type="button" class="close glyphicon glyphicon-remove" data-dismiss="modal"></button>
                <h4 class="modal-title">Acesso</h4>
            </div>
            <div class="modal-body">
                <form name="fomrlogin" role="form" method="POST" action="confirm-login.php">
                    <fieldset>
                        <div class="form-group col-md-8">
                            <label>E-mail</label>
                            <input type="email" class="form-control" name="email" placeholder="E-mail" required>
                        </div>
                        <div class="form-group col-md-6">
                            <label for="password">Senha</label>
                            <input type="password" class="form-control" name="senha" id="password" placeholder="Senha" required>
                        </div>
                    </fieldset>
                    <div class="form-group">
                        <div class="col-md-12">
                            <button type="submit" name="login" class="btn corbotao">Entrar</button>
                        </div>
                    </div>
                </form> 
            </div>
        </div>
    </div>
</div>
                <a data-toggle="modal" data-target="#modal-mensagem" href="">Já possui uma conta?</a>
    
asked by anonymous 28.09.2017 / 00:10

1 answer

1

The problem is that you are inserting a form into another form and this is not allowed. I've already commented on this here:

I have one form inside the other and I can not get the most internal form

<div class="container">
    <div class="row espacamento">
        <div class="col-md-8 col-md-offset-2">
            <form role="form" method="POST" action="confirmacao.php">
                <fieldset>
                    <div class="form-group col-md-12">
                        <legend>Cadastro</legend>
                    </div>

                    ...

                </fieldset>

                <!--CHAMANDO O MODAL-->
                <div class="form-group">
                    <div class="col-md-12">
                        <button type="submit" name="enviar" class="btn corbotao">Cadastrar</button>
                        <?php include 'login-conta.php';?>                      
                    </div>                  
                </div>
            </form>
        </div>
    </div>
</div>

Note that your include is 3 lines before you close the registration form. To work around the problem, simply enter include elsewhere in the HTML:

<div class="container">
    <div class="row espacamento">
        <div class="col-md-8 col-md-offset-2">
            <form role="form" method="POST" action="confirmacao.php">
                <fieldset>
                    <div class="form-group col-md-12">
                        <legend>Cadastro</legend>
                    </div>

                    ...

                </fieldset>

                <div class="form-group">
                    <div class="col-md-12">
                        <button type="submit" name="enviar" class="btn corbotao">Cadastrar</button>             
                    </div>                  
                </div>
            </form>
        </div>
    </div>

    <?php include 'login-conta.php';?>   
</div>

For example, on the penultimate line, inside the div.container element. So you probably need to reposition the link " Already have an account?" By putting it directly into the cadastro.php file.

    
28.09.2017 / 01:21