4
Hello, friends. Once again I need your help. I am migrating my small system to Bootstrap. I am implementing modal windows in various parts of the system. I believe that one of the advantages of the Modal window is that the user can access the data without leaving the current page.
On the page php listing., the user clicks on one of the logs displayed on the screen to access more details. With this, it is directed to the page ver_detalhes.php? Cod=(code) and thus access the requested data. Then, if you want to access another record, you need to click the back button and choose another record.
With the Bootstrap window, I noticed that this will be much more practical. Just click on the desired record and access the data via Bootstrap modal. I’m doing this implementation, but I’m having some questions. I wonder if I’m doing it the right way.
On the page php listings., push the button:
<a data-toggle="modal" href="ver_detalhes.php?cod=<?php echo $codigo;?>" data-target="#myModal">Visualizar</a>
Inside this same page, after the tag body, I put the modal skeleton:
<!-- Janela Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body"></div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
On the page ver_details.php, I inserted the following code of the modal window (I don’t know if it is necessary) with the requested PHP data, being as follows:
<div class="modal-header bg-primary">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Visualizar acessos - Banco de Currículos</h4>
</div> <!-- /modal-header -->
<div class="modal-body">
//AQUI INSERI O CODIGO PHP EXIBINDO OS DADOS DESEJADOS
</div> <!-- /modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
Upshot:
The modal window is displayed with the requested data, however, I checked that every time I open the modal screen, the background gets darker and darker. That is, at the first click, the background is normal. When closing and opening again the modal, the background becomes darker, and so on. It’s like every time he loads the increased number of modals.
Guys, could you check what’s wrong with the above structure? That way I used to call the modal I saw on a forum on the internet.
But do you want the modal to appear on the page of the listings? That is, in the line that clicks appear the corresponding data?
– Miguel
Hello, miguel. That’s right, as soon as the user clicks on a list record, the modal is displayed above.
– Luis
I guess I wouldn’t need the page ver_details.php could do all this in php listings., the fact that the
background
being dark has to do with this, because themodal
is on another page.– Igor Mello
Hello, Igor! In this case, in case I don’t use the page "Ver_details.php", how should I proceed to perform the passing of parameters? As I did above, the parameters are passed in the url. And in this case?
– Luis
Try to pass the data to the modal through the button, or in that way.
– Ivan Ferrer
The modal in the.php listings is useless and should be removed. When you click the button you go straight to the page ver_details.php? Cod=<? php echo $code;? > Not the solution to the problem but an observation.
– user60252