Advertisement
mvsp

editar.php

Jul 7th, 2021
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. <?php
  2. //Conexão
  3. include_once 'php_action/db_connect.php';
  4.  
  5. //Header
  6. include_once("includes/header.php");
  7. //Select
  8. if(isset($_GET['id'])):
  9.     $id = mysqli_escape_string($connect, $_GET['id']);
  10.  
  11.     $sql = "SELECT * FROM clientes WHERE id = '$id' ";
  12.     $resultado = mysqli_query($connect, $sql);
  13.     $dados = mysqli_fetch_array($resultado);
  14. endif;
  15. ?>
  16.  
  17. <div class="row">
  18.     <div class="col s12 m6 push-m3">
  19.         <h3 class="light">Editar Cliente</h3>
  20.         <form action="php_action/update.php" method="POST">
  21.             <input type="hidden" name="id" value="<?php echo $dados['id']; ?>">
  22.             <div class="input-field col s12">
  23.                 <input type="text" name="nome" id ="nome" value="<?php echo $dados['nome']; ?>">  
  24.                 <label for="nome">Nome</label>
  25.             </div>
  26.  
  27.             <div class="input-field col s12">
  28.                 <input type="text" name="sobrenome" id ="sobrenome" value="<?php echo $dados['sobrenome']; ?>" >
  29.                 <label for="sobrenome">Sobrenome</label>
  30.             </div>
  31.  
  32.             <div class="input-field col s12">
  33.                 <input type="text" name="email" id ="email" value="<?php echo $dados['email']; ?>" >
  34.                 <label for="email">Email</label>
  35.             </div>
  36.  
  37.             <div class="input-field col s12">
  38.                 <input type="text" name="idade" id ="idade" value="<?php echo $dados['idade']; ?>">
  39.                 <label for="idade">Idade</label>
  40.             </div>
  41.  
  42.             <button type="submit" name ="btn-editar" class="btn">Atualizar</button>
  43.             <a href ="index.php" type="submit" class="btn green" >Lista de clientes</a>
  44.         </form>
  45.        
  46.     </div>
  47.  
  48.  
  49. <?php
  50. include_once("includes/footer.php");
  51. ?>
  52.  
  53.  
  54.      
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement