Modal receiving data from the database

0

My product page displays all registered products from the database as div below.

<?php

                    $id_up = $GET["id"];
                    require("funcoes/conexao.php");

                    $quantidade = 10;

                    $p = (isset($_GET['p'])) ? (int)$_GET['p']: 1;

                    $inicio = ($quantidade * $p) - $quantidade; 

                    $sql = mysql_query("SELECT * FROM produtos ORDER BY desc_produtos ASC LIMIT $inicio, $quantidade") or die (mysql_error());              

                    while ($res_sql = mysql_fetch_array($sql)) {

                        echo '

<div class="gallery-grid col-md-3">
  <a href="#modal"><img src="web/images/'.$res_sql["img_produtos"].'" alt=""> 
  <span>Clique e Veja Mais Informações do Produto</span></a>
   <h5>'.$res_sql["desc_produtos"].'</h5></br>
<div class="gallery-button" class="cd-trigger"><a href="#modal">Leia Mais</a></div>

I have a modal created that when clicking Read More or Click and see more information of the product is already opening the Modal that I want and this modal has the following code that is at the end of this product page.

<div id="modal">
    <div class="modal-content">
        <div class="header">
            <h2>Categoria</h2>
        </div>
        <div class="copy">
            <p>aqui pegaria as informações do produto no banco de dados.</p>
        </div>
        <div class="cf footer">
            <a href="#" class="btn">Close</a>
        </div>
    </div>
    <div class="overlay"></div>
</div>          

The question is how do I do when I click on Read More or Click and see more information on the product opens this Modal, but with the information of products that comes from the database?

    
asked by anonymous 04.07.2018 / 15:44

1 answer

0

Man you need to pass the product id through the button that calls the modal, then receive that id in the modal, hence it will give the rest of the information inside that modal.

    
06.07.2018 / 17:11