This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Incluir arquivo de conexão | |
require_once 'config/database.php'; | |
// Processar operação de exclusão após confirmação | |
if (isset($_GET["id"]) && !empty(trim($_GET["id"]))) { | |
// Obter parâmetro da URL | |
$id = trim($_GET["id"]); | |
// Preparar uma declaração de exclusão |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Incluir arquivo de conexão | |
require_once 'config/database.php'; | |
// Processar dados do formulário quando for enviado | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
// Validar ID | |
if (!isset($_POST["id"]) || empty(trim($_POST["id"]))) { | |
header("location: error.php"); | |
exit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Incluir arquivo de conexão | |
require_once 'config/database.php'; | |
// Verificar se o ID foi passado | |
if (isset($_GET["id"]) && !empty(trim($_GET["id"]))) { | |
// Obter parâmetro da URL | |
$id = trim($_GET["id"]); | |
// Preparar uma declaração select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Incluir arquivo de conexão | |
require_once 'config/database.php'; | |
// Inicializar variáveis | |
$nome = $telefone = $email = ""; | |
$nome_err = $telefone_err = $email_err = ""; | |
// Processar dados do formulário quando for enviado | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Incluir arquivo de conexão | |
require_once 'config/database.php'; | |
// Consulta para selecionar todos os contatos | |
$sql = "SELECT * FROM contatos ORDER BY nome ASC"; | |
$result = mysqli_query($conn, $sql); | |
// Verificar se há erros na consulta | |
if (!$result) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Criar o banco de dados | |
CREATE DATABASE agenda; | |
-- Usar o banco de dados | |
USE agenda; | |
-- Criar a tabela contatos | |
CREATE TABLE contatos ( | |
id INT(11) NOT NULL AUTO_INCREMENT, | |
nome VARCHAR(100) NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Configurações do banco de dados | |
$host = "localhost"; | |
$username = "root"; | |
$password = ""; | |
$database = "agenda"; | |
// Criar conexão | |
$conn = mysqli_connect($host, $username, $password, $database); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="pt-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="assets/css/estilo.css"> | |
<title>Página Inicial</title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url("https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"); | |
*{ | |
margin:0; | |
padding:0; | |
box-sizing: border-box; | |
} | |
body{ | |
background-image: linear-gradient(rgb(7, 11, 91), rgb(102, 207, 100)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colecaoUf = [ | |
{ | |
id: 1, | |
uf: "AC", | |
nome: "Acre" | |
}, | |
{ | |
id: 2, | |
uf: "AL", | |
nome: "Alagoas" |