-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormularioCadastroCliente.php
151 lines (143 loc) · 5.37 KB
/
FormularioCadastroCliente.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
<?php
$host = "localhost";
$user = "root";
$pass = "";
$banco = "user";
$conexao = mysql_connect($host, $user, $pass);
mysql_select_db($banco) or die (mysql_error());
?>
<?php
session_start();
if(!isset($_SESSION["user"]) || !isset($_SESSION["password"])){
header("Location: Login.php");
exit;
}
$NomeUser=$_SESSION["user"];
?>
<?php
function conveniosDisp(){
$BD = "SELECT * FROM convenio";
$sql = mysql_query($BD) or die(mysql_error());
$row = mysql_num_rows($sql);
echo '<option value="2">Particular</option>';
if ($row > 0){
while ($linha = mysql_fetch_array($sql)) {
$status = $linha['status'];
if ($status) {
$id = $linha['id'];
$nome = $linha['nome'];
echo '<option value="'.$id.'">'.$nome.'</option>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<title>Cadastro Cliente</title>
<link rel="shortcut icon" href="css/imagens/parae.ico" type="image/x-icon" />
<center><img src="css/imagens/paraefinal.png" class="img-rounded" width="200" height="205" onclick="location.href='paginicial.php'"></center>
<div align="right"> Olá, <?php echo $NomeUser ?> | <a href="paginicial.php"><i class="icon-home"></i></a> | <a href="logout.php">Sair</a></div>
<center><h3>CADASTRO CLIENTE</h3></center>
<br><br>
<script language="Javascript">
function validar(){
if(document.form.name.value==""){
alert("Por favor, insira o nome!");
document.form.name.focus();
return false;
}
if(document.form.cpf.value==""){
alert("Por favor, insira o CPF!");
document.form.cpf.focus();
return false;
}
if(document.form.rg.value==""){
alert("Por favor, insira o RG!");
document.form.rg.focus();
return false;
}
if(document.form.endereço.value==""){
alert("Por favor, informe o endereço!");
document.form.endereço.focus();
return false;
}
if(document.form.telefone.value=="") {
alert("Por favor, insira o telefone!");
document.form.telefone.focus();
return false;
}
if(document.form.placa.value=="") {
alert("Por favor, informe a placa do veículo!");
document.form.placa.focus();
return false;
}
if(document.form.modelo.value==""){
alert("Por favor, insira o modelo do veículo!");
document.form.modelo.focus();
return false;
}
if(document.form.codigo.value==""){
alert("Por favor, insira o numero do Cartão!");
document.form.codigo.focus();
return false;
}
}
function formatar(mascara, documento){
var i = documento.value.length;
var saida = mascara.substring(0,1);
var texto = mascara.substring(i)
if (texto.substring(0,1) != saida){
documento.value += texto.substring(0,1);
}
}
</script>
</head>
<body>
<form name = "form" action="RealizaCadastroCliente.php" method="post" onsubmit="return validar();">
<center>
<label>
<h5>Nome:</h5>
<input type="text" class="form-control" name="name" placeholder="José da Silva">
</label>
<label>
<h5>CPF:</h5>
<input type="text" class="form-control input-lg" name="cpf" placeholder="123.456.789-00" OnKeyPress="formatar('###.###.###-##', this)" maxlength="14">
</label>
<label>
<h5>RG:</h5>
<input type="text" class="form-control input-lg" name="rg" placeholder="MG19199199" maxlength="12">
</label>
<h5>Endereço:</h5>
<input type="text" class="form-control input-lg" name="endereco" placeholder="Rua, Nº, Bairro, CEP, Cidade">
<h5>Telefone:</h5>
<input type="tel" class="form-control input-lg" placeholder="XX 3123-4567" OnKeyPress="formatar('## ####-####', this)" name="telefone" maxlength="13">
<h5>Placa:</h5>
<input type="text" class="form-control input-lg" name="placa" placeholder="ABC-1234" OnKeyPress="formatar('###-####', this)" maxlength="8">
</label>
<label>
<h5>Modelo:</h5>
<input type="text" class="form-control" name="modelo" placeholder="Volkswagen Gol">
</label>
<label>
<h5>Convênio:</h5>
<SELECT name= "convenio">
<?php
conveniosDisp();
?>
</SELECT>
</label>
<label>
<h5>Codigo Cartão:</h5>
<input type="text" class="form-control" name="codigo" >
</label>
<label>
<br>
<p><button class="btn btn-default" type="button" onclick="location.href='javascript:window.history.go(-1)'">Voltar</button>
      
<button class="btn btn-default" type="submit">Cadastrar</button></p>
</label>
<br>
</form></center>