-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
46 lines (39 loc) · 1.08 KB
/
index.php
File metadata and controls
46 lines (39 loc) · 1.08 KB
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
<?php
/*aqui vamos conectar
com o banco
de dados*/
$servername = "localhost";
//você deu nome ao banco de dados
$database = ""; //func2c ou func2d
$username = "root";
$password = "";
$conexao = mysqli_connect(
$servername, $username,
$password,$database
);
if (!$conexao){
die("Falha na conexão".mysqli_connect_error());
}
//echo "conectado com sucesso";
$id = $_POST["id"];
$nome = $_POST["nome"];
$cpf = $_POST["cpf"];
$botao = $_POST["botao"];
echo $id." ".$nome." ".$cpf." ".$botao;
$sql_cadastrar = "INSERT INTO funcionarios
(id, nome, cpf) VALUES('','$nome', '$cpf')";
?>
<html>
<body>
<form name = "func" method = "post" >
<label>ID</label>
<input type ="text" name = "id" /><br />
<label>Nome</label>
<input type ="text" name = "nome" /><br />
<label>CPF</label>
<input type ="text" name = "cpf" /><br />
<input type ="submit" name = "botao" value = "cadastrar" />
<input type ="reset" name = "botao" value = "cancelar" />
</form>
</body>
</html>