-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
81 lines (56 loc) · 1.43 KB
/
index.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
<?php
require_once("sql.php");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Sistema</title>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<nav id="menu">
<ul>
<li>
<a href="#">
#Registrar
</a>
</li>
<li>
<a href="consulta.php">
#Consultar
</a>
</li>
</ul>
</nav>
<form method="post" id="formularioRegistro">
<label> <h4>Cadastro de Serviço </h4> </label>
<input type="hidden" name="atualizar" value="<?php echo $_GET['id'];?>">
#nome
<input type="text" name="nomeCliente" placeholder="Nome" >
#telefone
<input type="text" name="telefoneCliente" placeholder="Telefone">
#valor
<input type="text" name="valorPagar" placeholder="Valor" value="R$ ">
<br>
<input type="submit" name="cadastrar" value="Registrar" class="cadastroBD">
<?php
try{
if(isset($_POST['cadastrar'])){
$nome = $_POST['nomeCliente'];
$telefone = $_POST['telefoneCliente'];
$valor = $_POST['valorPagar'];
$stmt = $conn->prepare("INSERT INTO `dadoscliente` (nome,telefone,valor) VALUES(:nome ,:telefone, :valor)");
$stmt->bindParam(":nome", $nome);
$stmt->bindParam(":telefone", $telefone);
$stmt->bindParam(":valor", $valor);
$stmt->execute();
echo 'Cadastrado com sucesso';
}
}catch(Exception $e){
echo "Erro |" .$e->getMessage(). " Contate o desenvolvedor";
}
?>
</form>
</body>
</html>