-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinserir.php
159 lines (124 loc) · 4.03 KB
/
inserir.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!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">
<title>CE MTLS&A Inserir</title>
<link rel= "stylesheet" href = "style/estiloPadrao.css">
<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
<style>
/* body{
background-color:#F5588F;
}
h1,h2,h3{
text-align: center;
color:#58F565;
font-size: 2rem;
}
p{
color: #A81B4D;
}
main{
border: 5px solid #2CA836;
background-color: #75FF81;
width: 50%;
margin-left: 400px;
text-align: center;
border-radius: 50px;
}*/
</style>
</head>
<body>
<header>
<h1>Curriculo</h1>
<ul><!--Lista de botoes de cabeçalho-->
<li><a href="index.php">Página Inicial</a></li>
<li><a href="inserir.php">Inserir</a></li>
<li><a href="Consulta.php">Consulta</a></li>
<li><a href="Editar.php">Editar</a></li>
<li><a href="excluir.php">Excluir</a></li>
<li><a href="sobre.php">Sobre</a></li>
</ul>
</header>
<main>
<div id="containerPainel">
<form method ="POST" action="inserir.php">
<p>Nome: <input type="text" name="nome"> </p>
<p>Data de Nascimento: <input type="date" name="data" > </p>
<p>Formação: <input type="text" required="required" name="forma" > </p>
<p>Endereço: <input type="text" required="required" name="ender" ></p>
<p>CPF: <input type="text" required ="required" name="cpf" ></p>
<p>E-mail: <input type="email" required="required" class="input-text" name="email"></p>
<p>Telefone: <input type="text" required="required" name="tele" > </p>
<p>Experiencia: <input type="text" required="required" name="expe" > </p>
<input type="reset" value="Limpar">
<input type="submit" value="Enviar">
</form>
<?php
if(isset($_POST["nome"])){ //toda váriavel em php começa com cifrão, pra entennder que é váriavel, se nome foi preenchido a variavel de méotdo post vai receber o nome
$nome = $_POST["nome"]; // o isset confere se uma váriavel foi definida
}
else{
$nome = null; // se não foi preenchido o dado será nulo
}
if(isset($_POST["data"])){
$data = $_POST["data"];
}
else{
$data = null;
}
if(isset($_POST["forma"])){
$forma = $_POST["forma"];
}
else{
$forma = null;
}
if(isset($_POST["ender"])){
$ender = $_POST["ender"];
}
else{
$ender = null;
}
if(isset($_POST["cpf"])){
$cpf = $_POST["cpf"];
}
else{
$cpf = null;
}
if(isset($_POST["email"])){
$email = $_POST["email"];
}
else{
$email = null;
}
if(isset($_POST["tele"])){
$tele = $_POST["tele"];
}
else{
$tele = null;
}
if(isset($_POST["expe"])){
$expe = $_POST["expe"];
}
else{
$expe = null;
}
if($nome != null && $data !=null && $forma !=null && $ender != null && $cpf != null && $email !=null && $tele != null && $expe !=null){ //php pode ser and ou &&
include("conecta.php");
$sql = "INSERT INTO cadastro (nome, tele, mail, ende, cpf, dnas, forma, expe)
VALUES ('$nome', '$tele','$email', '$ender', '$cpf','$data', '$forma', '$expe')";
if($conn->query($sql) === TRUE) {
echo "Cadastrado";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
else{
echo "Preencha todos os campos";
}
?>
</div>
</main>
</body>
</html>