mvsp

index.php

Jul 7th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. //Conexão
  5. include_once 'php_action/db_connect.php';
  6.  
  7.  
  8. //Header
  9. include_once 'includes/header.php';
  10.  
  11. //Message
  12. include_once 'includes/message.php';
  13. ?>
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. <div class="row">
  21.     <div class="col s12 m6 push-m3">
  22.         <h3 class="light">Clientes </h3>
  23.         <table class="striped">
  24.             <thead>
  25.                 <tr>
  26.                     <th>Nome</th>
  27.                     <th>Sobrenome</th>
  28.                     <th>Email:</th>
  29.                     <th>Idade:</th>
  30.                 </tr>
  31.             </thead>
  32.  
  33.             <tbody>
  34.                 <?php
  35.                 $sql = "SELECT * FROM clientes";
  36.                 $resultado = mysqli_query($connect,$sql);
  37.  
  38.                 if(mysqli_num_rows($resultado)> 0):
  39.  
  40.  
  41.                 while($dados = mysqli_fetch_array($resultado)):
  42.                 ?>
  43.                 <tr>
  44.                     <td><?php echo $dados['nome']; ?></td>
  45.                     <td><?php echo $dados['sobrenome']; ?></td>
  46.                     <td><?php echo $dados['email']; ?></td>
  47.                     <td><?php echo $dados['idade']; ?></td>
  48.                     <td><a href="editar.php?id=<?php echo $dados['id']; ?>"class="btn-floating orange"><i class="material-icons">edit</i></a></td>
  49.  
  50.                     <td><a href="#modal<?php echo $dados['id']; ?>" class="btn-floating red modal-trigger"><i class="material-icons">delete</i></a></td>
  51.  
  52.                       <!-- Modal Structure -->
  53.                       <div id="modal<?php echo $dados['id']; ?>" class="modal">
  54.                         <div class="modal-content">
  55.                           <h4>Opa!</h4>
  56.                           <p>Tem certeza que deseja excluir esse cliente?</p>
  57.                         </div>
  58.                         <div class="modal-footer">
  59.                          
  60.  
  61.                           <form action="php_action/delete.php" method="POST">
  62.                             <input type="hidden" name="id" value = "<?php echo $dados['id']; ?>">
  63.                             <button type="submit" name="btn-deletar" class="btn red">Sim, quero deletar</button>
  64.  
  65.                             <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Cancelar</a>
  66.  
  67.                           </form>
  68.  
  69.                         </div>
  70.                       </div>
  71.  
  72.                 </tr>
  73.             <?php
  74.             endwhile;
  75.             else: ?>
  76.                 <tr>
  77.                     <td>-</td>
  78.                     <td>-</td>
  79.                     <td>-</td>
  80.                     <td>-</td>
  81.                 </tr>
  82.  
  83.             <?php
  84.             endif;
  85.             ?>
  86.             </tbody>
  87.  
  88.         </table>
  89.         <br>
  90.         <a href="adicionar.php" class="btn">Adicionar cliente</a>
  91.     </div>
  92.  
  93.  
  94. <?php
  95. include_once("includes/footer.php");
  96. ?>
  97.  
  98.  
  99.      
Advertisement
Add Comment
Please, Sign In to add comment