0
Personal I have a form for candidate registration. To save in the bank it passes the values by javascript for the salvaCandidato.php. I’m trying to make the form to appear the modal saying the registration protocol that is in the variable $nr_prot in salvaCandidato.php, I’m not getting through.
index php.
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Observação</h4>
</div>
<div class="modal-body">
<h4>Anote seu protocolo</h4>
<h4>$nr_prot</h4>
<h4> O protocolo foi enviado para o email </h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</div>
salvaCandidato.php
$sqlProt = "SELECT * FROM candidato WHERE cpf_cand = '$_POST[cpf_cand]'";
$queryProt = mysqli_query($conexao,$sqlProt);
$fetchProtocolo = mysqli_fetch_assoc($queryProt);
$nr_prot = $fetchProtocolo['nr_prot'];
You cannot put a PHP variable inside pure HTML like you did
<h4>$nr_prot</h4>
. If the modal opens in PHP you need to use<h4><?php echo $nr_prot;?></h4>
– Papa Charlie
It was just to illustrate, I tried to use $_SESSION and $_POST, but it doesn’t come
– Laercio Silva Soutilha
You will have to put the protocol number in the modal via javascript. See an example $("#modal-body"). html('your protocol number');
– Alexandre Cardoso