Last active
February 12, 2023 01:27
-
-
Save DevWellington/3a04632fc387878ac45f to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Cadastro de Funcionários</title> | |
<link rel="stylesheet" text="text/css" href="estilo.css"> | |
</head> | |
<body> | |
<?php | |
require ("config.php"); | |
?> | |
<?php | |
$nome = $_POST['nome']; | |
$email = $_POST['email']; | |
$setor = $_POST['setor']; | |
$cargo = $_POST['cargo']; | |
$foto = $_POST['foto']; | |
$sql = "INSERT INTO funcionarios (nome, email, setor, cargo, foto) | |
VALUES (:nome, :email, :setor, :cargo, :foto) | |
"; | |
$stmt = $conexao->prepare($sql); | |
$params = array( | |
':nome' => $nome, | |
':email' => $email, | |
':setor' => $setor, | |
':cargo' => $cargo, | |
':foto' => $foto | |
); | |
$stmt->execute($params); | |
echo "<script> | |
alert('Funcionário cadastrado com sucesso.'); | |
</script> | |
<meta http-equiv='refresh' content='0, url=funcionarios.php'> | |
"; | |
?> | |
</body> | |
</html> |
This file contains 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
<meta charset="utf-8"> | |
<?php | |
$host = "localhost"; | |
$user = "root"; | |
$pass = ""; | |
$banco = "empresa"; | |
$conexao = new mysqli($host,$user,$pass,$banco); | |
if (mysqli_connect_errno()) { | |
die('Não foi possível conectar-se ao banco de dados: ' . mysqli_connect_error()); | |
exit(); | |
} | |
?> |
This file contains 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
body{ | |
margin: 0; | |
padding: 0; | |
outline: none; | |
font-family: "Arial"; | |
} | |
.txt{ | |
height: 35px; | |
width: 250px; | |
border: none; | |
border-radius: 5px; | |
background-color: #EEE; | |
padding: 4px; | |
} | |
table#tab_lista{ | |
height: 250px; | |
margin: 0 auto; | |
padding: 10px; | |
margin-top: 100px; | |
border-collapse: collapse; | |
box-shadow: 5px 5px 2.5px #888888; | |
border:1px solid #000000; | |
} | |
table#tab_lista td, tr { | |
border: 1px solid #CCC; | |
} | |
#tab_cadastro{ | |
height: 250px; | |
margin: 0 auto; | |
padding: 10px; | |
margin-top: 200px; | |
} | |
input#botao_cad{ | |
width: 100px; | |
height: 30px; | |
background-color: #EFEFEF; | |
border-radius: 4px; | |
border: 1px solid #CCC; | |
} | |
#cor_cabecalho{ | |
background-color: #AAA; | |
font-weight: bold; | |
text-align: center; | |
} |
This file contains 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 | |
require ("config.php"); | |
?> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Cadastro de Funcionários</title> | |
<link rel="stylesheet" text="text/css" href="estilo.css"> | |
</head> | |
<body> | |
<div id="cadastro"> | |
<form name="signup" method="post" action="cadastro.php"> | |
<table id="tab_cadastro"> | |
<tr> | |
<td>Nome:</td> | |
<td><input type="text" name="nome" required placeholder="Nome do funcionário" id="nome" class="txt" /></td> | |
</tr> | |
<tr> | |
<td>E-mail:</td> | |
<td><input type="text" name="email" required placeholder="E-mail do Funcionário" id="email" class="txt" /></td> | |
</tr> | |
<tr> | |
<td>Setor:</td> | |
<td><input type="text" name="setor" required placeholder="Setor do Funcionário" id="setor" class="txt" /></td> | |
</tr> | |
<tr> | |
<td>Cargo:</td> | |
<td><input type="text" name="cargo" required placeholder="Cargo do Funcionário" id="cargo" class="txt" /></td> | |
</tr> | |
<tr> | |
<td>Foto:</td> | |
<td><input type="text" name="foto" required placeholder="Foto do Funcionário" id="foto" class="txt" /></td> | |
</tr> | |
<tr> | |
<td colspan="2"><input type="submit" value="Cadastrar" name="go" id="botao_cad"></td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I managed to solve the error in my code :)