Advertisement
hercioneto

excluirDados.php

Sep 21st, 2023
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.54 KB | None | 0 0
  1. <!Doctype html>
  2. <html lang="pt-br">
  3. <head>
  4.     <meta charset="utf-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1">
  6.     <meta name="Author" content="Hercio Neto">
  7.     <title>Aula HTML - Formulários</title>
  8.  
  9.     <style type="text/css">
  10.         body {
  11.             font-family: Arial, sans-serif;
  12.             font-size: 16px;
  13.             background-color: #f0f0f0;
  14.         }
  15.         .container {
  16.             max-width: 800px;
  17.             margin: 0 auto;
  18.             padding: 20px;
  19.             background-color: #fff;
  20.             box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
  21.         }
  22.         form label {
  23.             display: block;
  24.             margin-bottom: 5px;
  25.             font-weight: bold;
  26.  
  27.         }
  28.         form input[type="text"], form input[type="email"], form select {
  29.  
  30.             width: 98%;
  31.              
  32.             padding: 10px;
  33.              
  34.             border: 1px solid #ccc;
  35.              
  36.             border-radius: 4px;
  37.              
  38.             margin-bottom: 20px;
  39.  
  40.         }
  41.  
  42.         form input[type="submit"] {
  43.  
  44.         background-color: #ec2300;
  45.          
  46.         color: #fff;
  47.          
  48.         padding: 10px 20px;
  49.          
  50.         border: none;
  51.          
  52.         border-radius: 4px;
  53.          
  54.         cursor: pointer;
  55.          
  56.         }
  57.  
  58.         form input[type="submit"]:hover {
  59.  
  60.         background-color: #aa2913;
  61.          
  62.         }
  63.  
  64.  
  65.         @media screen and (max-width: 480px) {
  66.  
  67.         form input[type="text"], form input[type="email"], form select {
  68.  
  69.             width: 90%;
  70.              
  71.         }
  72.  
  73.         form input[type="submit"] {
  74.  
  75.         width: 90%;
  76.          
  77.         }
  78.  
  79.         }
  80.  
  81.     </style>
  82.    
  83.  
  84. </head>
  85.  
  86. <body >
  87.  
  88.     <div class="container">
  89.  
  90.     <h1>Exclusão de Pessoa</h1>
  91.  
  92.     <?php
  93.  
  94.     if (!is_null($_GET['codigo'])) {
  95.  
  96.     $codigo = $_GET['codigo'];
  97.  
  98.     $conexao = new mysqli("localhost", "root", "", "uri_web");
  99.  
  100.     // Verificar se a conexão foi estabelecida corretamente
  101.     if ($conexao->connect_error) {
  102.         die("Erro na conexão: " . $conexao->connect_error);
  103.     }
  104.  
  105.     $sql = "SELECT * FROM pessoas where codigo = $codigo";
  106.     $resultado_pagina = $conexao->query($sql);
  107.  
  108.      if ($resultado_pagina->num_rows > 0) {
  109.  
  110.            while ($registro = $resultado_pagina->fetch_assoc()) {
  111.  
  112.  
  113.          ?>
  114.    
  115.     <form method="POST" action="confirmaExclusaoDados.php">
  116.  
  117.         <label for="nome">Nome:</label>
  118.         <input type="text" id="nome" name="nome" required value="<?php echo $registro["nome"]; ?>" disabled>
  119.         <input type="hidden" name="codigo" value="<?php echo $registro["codigo"]; ?>">
  120.  
  121.         <label for="email">E-mail:</label>
  122.         <input type="email" id="email" name="email" required value="<?php echo $registro["email"]; ?>" disabled>
  123.  
  124.         <input type="submit" value="Clique se deseja realmente excluir">
  125.        
  126.     </form>
  127. <?php } }
  128. } else { echo "<br>Selecione um registro."; }
  129. ?>
  130.  
  131.     </div>
  132.    
  133. </body>
  134.  
  135. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement