-
Notifications
You must be signed in to change notification settings - Fork 0
/
PesquisaCliPessoaCpf.php
98 lines (94 loc) · 4.23 KB
/
PesquisaCliPessoaCpf.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
<?php
include "Confere_2.php";
?>
<?php
include ('cabecalho2.php')
?>
<title>Pesquisar Clientes por CPF</title>
<div style="background-color: #343a40; width:100%; height: 100%;">
<h2 style="color:white; text-align:center;">Pesquisar Clientes por CPF</h2>
<table class="table table-hover table-dark" border="1">
<tr>
<th style="color:white; text-align:center;">Nome do cliente</th>
<th style="color:white; text-align:center;">CPF</th>
<th style="color:white; text-align:center;">Telefone</th>
<th style="color:white; text-align:center;">Email</th>
<th style="color:white; text-align:center;">ID</th>
</tr>
<?php
include "conexao.php";// CONECTA AO BANCO
$cliente= $_REQUEST["txtcliente"];// RETOMA A VARIAVEL DE CONSULTA
$sql="SELECT * FROM clientesPessoas where cpf like '%$cliente%'";// SELECIONA OS CLIENTES
//DE ACORDO COM O METODO UTILIZADO
if($result=$mysqli->query($sql)){
while($row=$result->fetch_assoc()){
echo '<tr>';
echo '<td>' .$row['nome']. '</td>';
echo '<td>' .$row['cpf']. '</td>';
echo '<td>' .$row['telefone']. '</td>';
echo '<td>' .$row['email']. '</td>';
echo '<td>' .$row['id_clientePessoa']. '</td>' ;
echo '</tr>';
}
}
//include "desconecta.php";
?>
</table>
<!-- SABENDO O ID E OS DADOS DO CLIENTE, O ADMINISTRADOR OU FUNCIONARIO
TEM A OPÇÃO DE EXCLUÍ-LO OU EFETUAR UMA NOVA BUSCA-->
<form method="post" action="PesquisaCliPessoaCpf.php"><!-- ENVIA NOVAMENTE
PARA A PESQUISA -->
<table class="table table-hover table-dark" border="1">
<tr>
<td style="text-align:right">Nova busca:</td>
<td><input type="text" name="txtcliente" size="40" /></td>
</tr>
<tr>
<td style="text-align:right"> </td>
<td><input class="btn btn-primary btn-lg" type="submit" value="PESQUISAR" /></td>
</tr>
</form>
<form method="post" action="ApagaCompleto.php">
<input type="hidden" id="tabcliempfun" name="tabcliempfun" value="clientesPessoas">
<input type="hidden" id="idcliempfun" name="idcliempfun" value="id_clientePessoa">
<tr>
<td style="text-align:right">ID do cliente:</td>
<td><input type="text" name="id" size="5"></td>
</tr>
<tr>
<td style="text-align:right"> </td>
<td><input class="btn btn-primary btn-lg" type="submit" value="APAGAR" /></td>
</tr>
</form>
<form method="post" action="AlteraDados.php">
<input type="hidden" id="tabcliempfun" name="tabcliempfun" value="clientesPessoas">
<input type="hidden" id="idcliempfun" name="idcliempfun" value="id_clientePessoa">
<tr>
<td style="text-align:right">ID da pessoa:</td>
<td><input type="text" name="id" size="5"></td>
</tr>
<tr>
<td style="text-align:right">Alterar dado:</td>
<td>
<select name="dado">
<option value="nome">Nome</option>
<option value="cpf">CPF</option>
<option value="telefone">Telefone</option>
<option value="email">Email</option>
</select>
</td>
</tr>
<tr>
<td style="text-align:right">Novo dado:</td>
<td><input type="text" name="novodado"></td>
</tr>
<tr>
<td style="text-align:right"> </td>
<td><input class="btn btn-primary btn-lg" type="submit" value="ALTERAR" /></td>
</tr>
</table>
</form>
</div>
<?php
include ('rodape.php');
?>