Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!Doctype html>
- <html lang="pt-br">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="Author" content="Hercio Neto">
- <title>Aula HTML - Formulários</title>
- <style type="text/css">
- body {
- font-family: Arial, sans-serif;
- font-size: 16px;
- background-color: #f0f0f0;
- }
- .container {
- max-width: 800px;
- margin: 0 auto;
- padding: 20px;
- background-color: #fff;
- box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
- }
- form label {
- display: block;
- margin-bottom: 5px;
- font-weight: bold;
- }
- form input[type="text"], form input[type="email"], form select {
- width: 98%;
- padding: 10px;
- border: 1px solid #ccc;
- border-radius: 4px;
- margin-bottom: 20px;
- }
- form input[type="submit"] {
- background-color: #4CAF50;
- color: #fff;
- padding: 10px 20px;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- form input[type="submit"]:hover {
- background-color: #3e8e41;
- }
- @media screen and (max-width: 480px) {
- form input[type="text"], form input[type="email"], form select {
- width: 90%;
- }
- form input[type="submit"] {
- width: 90%;
- }
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>Cadastro de Pessoa</h1>
- <?php
- // Verificar se o formulário foi submetido
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- if (isset($_POST['codigo'])) {
- ?>
- <label for="codigo">Excluindo código:</label>
- <?php
- $codigo = $_POST['codigo'];
- echo $codigo; ?>
- <?php
- $conexao = new mysqli("localhost", "root", "", "uri_web");
- // Verificar se a conexão foi estabelecida corretamente
- if ($conexao->connect_error) {
- die("Erro na conexão: " . $conexao->connect_error);
- }
- $sql = "DELETE FROM pessoas WHERE `pessoas`.`codigo` = $codigo";
- $resultado_pagina = $conexao->query($sql);
- if ($resultado_pagina=="true"){
- echo "<br><h3>Dados excluídos com sucesso</h3>";
- } else {
- echo "Dados não excluídos, tente novamente.";
- }
- }
- } else {
- echo "Preencha o formulário";
- }
- ?>
- <p><a href="index.php">Voltar</a></p>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement