I need to call a modal with while, based on the category id selected on the site

1

I'm having trouble calling a modal based on my database, for example:

A user chooses the store category, and each category has an ID and in the modal, I want to appear the names of the stores that are of the respective category

And how do I call more than one modal? one on top of the other

This is PHP

<!-- Portfolio Grid -->
    <section class="bg-light" id="portfolio">
      <div class="container">
        <div class="row">
          <div class="col-lg-12 text-center">
            <h2 class="section-heading text-uppercase">Categorias</h2>
            <h3 class="section-subheading text-muted"></h3>
          </div>
        </div>

        <div class="row">
<?php
    require_once "conecta_db.php"; //CHAMA O ARQUIVO DE CONEXÃO COM BD

    $tb = "categorias";
    $sql = "SELECT * FROM ".$tb;
    $result=mysqli_query($con,$sql);

    while($linha = mysqli_fetch_assoc($result))
    {

?>       
        <div class="col-md-4 col-sm-6 portfolio-item">
            <a class="portfolio-link" data-toggle="modal" href="#portfolioModal1">
              <div class="portfolio-hover">
                <div class="portfolio-hover-content">
                  <i class="fa fa-plus fa-3x"></i>
                </div>
              </div>
              <img class="img-fluid" <?php echo "<img width=\"150\" height=\"150\" src=\"img/servicos/".$linha["idcat"].".png\">"; ; ?>
            </a>
            <div class="portfolio-caption">
              <h4><?php echo $linha["idcat"]; ?> <h1><?php echo utf8_encode ($linha["nome"]); ?></h4>
              <p class="text-muted"><?php echo utf8_encode ($linha["descricao"]);?></p>
            </div>
          </div>
   <?php
    } // fecha while

    // Free result set
    mysqli_free_result($result);
    mysqli_close($con);
?>
        </div>
      </div>
    </section>

And here is the modal

<div class="portfolio-modal modal fade" id="portfolioModal1" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="close-modal" data-dismiss="modal">
        <div class="lr">
          <div class="rl"></div>
        </div>
      </div>
      <div class="container">
        <div class="row">
          <div class="col-md-4 col-sm-6 portfolio-item">

           <div class="modal-body">
              <!-- Project Details Go Here -->
              <h2 class="text-uppercase">Project Name</h2>
              <p class="item-intro text-muted">Lorem ipsum dolor sit amet consectetur.</p>
              <img class="img-fluid d-block mx-auto" src="img/portfolio/01-full.jpg" alt="">
              <p>Use this area to describe your project. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est blanditiis dolorem culpa incidunt minus dignissimos deserunt repellat aperiam quasi sunt officia expedita beatae cupiditate, maiores repudiandae, nostrum, reiciendis facere nemo!</p>
              <ul class="list-inline">
                <li>Date: January 2017</li>
                <li>Client: Threads</li>
                <li>Category: Illustration</li>
              </ul>
              <button class="btn btn-primary" data-dismiss="modal" type="button">
                <i class="fa fa-times"></i>
                Close Project</button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
    
asked by anonymous 14.06.2018 / 05:43

0 answers