Work in the same modal bootstrap after submitting a form

0

I'm working on a project with Bootstrap Modals. I have already done the modals to create the content, delete, etc. But, I need to have one for editing ... And I have a few problems.

MODAL UPDATE:

In this mode, the user will enter the operator's ID, and then the PHP below will search the SQL and bring other realigned data (name, etc.). What I need is that after the search with PHP, the user returns to the same page with a new modal that brings the data (example the name of the operator), which he can edit and finally run an update in SQL (changing the data).

<!-- Atualizar Operadora -->
<div class="modal fade" id="atualizarOperadora" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fechar</span></button>
                <h3 class="modal-title" id="lineModalLabel">Atualizar Operadora</h3>
            </div>
            <div class="modal-body">   
                <!-- content goes here -->
                <form method="post" action="telaAtualizarConteudo.php">
                <div class="form-group">
                    <label for="inputAtualizarOperadora">ID Operadora</label>
                    <input type="text" name="IDOperadora" class="form-control" id="inputAtualizarOperadora" placeholder="Insira o ID da Operadora">
                </div>
                <div class="modal-footer">
                    <div class="btn-group btn-group-justified" role="group" aria-label="group button">
                        <div class="btn-group" role="group">
                            <button type="button" class="btn btn-default" data-dismiss="modal"  role="button">Fechar</button>
                        </div>
                        <div class="btn-group" role="group">
                            <button type="submit" name="atualizarOperadora" id="saveImage" class="btn btn-default btn-hover-green" data-action="save" role="button">Próximo</button>
                        </div>
                    </div>
                </div>    
                </form>    
            </div>    
        </div>
    </div>
</div>

screenUpdateConteudo.php

require_once("lib/conexao.php");
include('header.php'); 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {   
    if (isset($_POST['atualizarOperadora']))  { 
        $IDOperadora = (isset($_POST['IDOperadora'])) ? $_POST['IDOperadora'] : '';
        $strSQL = "SELECT * FROM operadora WHERE operadoraID = ".$IDOperadora."";   
        $query = mysqli_query($con, $strSQL);
        $result = mysqli_fetch_array($query);

The screen below does what I need, but on a separate page, without being modal, which spoils the design I need.

echo '<div class="text-center logo"><img src="img/logo.png"></div>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12 text-center">
            <h1>Atualizar Operadora</h1>
            <hr>        
            <form method="post" action="atualizarConteudo.php">
            <div class="form-group">
                <label for="inputAtualizarNomeOperadora">Operadora</label>
                <input type="text" name="atualizarNomeOperadora" class="form-control" id="inputAtualizarNomeOperadora" value="'.$result["nome"].'">
                <input type="hidden" name="IDOperadora" class="form-control" value="'.$IDOperadora.'">
            </div>
            <div class="btn-group" role="group">
                <button type="submit" name="aceitaAtualizarOperadora" id="saveImage" class="btn btn-default btn-hover-green" data-action="save" role="button">Salvar</button>
            </div>          
            </form>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12 text-center">
            <a href="page.php?pagina=Dados" class="btn btn-default btn-xlarge btn-voltar" role="button"><i class="fa fa-undo"></i> Voltar</a>
        </div>
    </div>
</div>';
    
asked by anonymous 09.11.2015 / 15:28

0 answers