Last active
May 12, 2023 19:11
-
-
Save silvadias22/dca852f3f5af60cca2b3 to your computer and use it in GitHub Desktop.
Crud - html - php - javascript - css - mysql (demonstração: https://emounter.com/crud/profissional.php )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> | |
<script language="javascript"> | |
function confirmaDel(){ | |
var r = confirm("Tem certeza que deseja excluir esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<div class="tabela"> | |
<?php | |
include "database.php"; | |
$stmt = buscarTodosProfissionais(); | |
?> | |
<?php | |
if ($stmt->rowCount() > 0){ ?> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id </th> | |
<th> Nome </th> | |
<th> Idade </th> | |
<th> Nascimento </th> | |
<th> Sexo </th> | |
<th> Estado Civil </th> | |
<th> Habilidade </th> | |
<th> vinculo </th> | |
<th> Horario de Entrada </th> | |
<th> Horario de Saida </th> | |
<th> Observação </th> | |
<th> Visualizar registros </th> | |
<th> Excluir tudo </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
$nascimento = $result['nascimento']; //efetua a busca da iformação | |
$nascimento = implode('/',array_reverse(explode('-',$nascimento)));// Inverte a posição da informação contida na variavel | |
$habilidade = $result['habilidade']; | |
$habilidade = implode('<br>',array_reverse(explode(',',$habilidade))); | |
$observacao = $result['observacao']; | |
$observacao = implode('<p>',array_reverse(explode(',',$observacao))); | |
?> | |
<tr> | |
<td><?php echo $result['idProfissional']; ?></td> | |
<td><?php echo $result['nome'];?></td> | |
<td><?php echo $result['idade'];?></td> | |
<td><?php echo $nascimento;?> | |
<td><?php echo $result['sexo']; ?></td> | |
<td><?php echo $result['estadoCivil']; ?></td> | |
<td><?php echo $habilidade;?></td> | |
<td><?php echo $result['vinculo']; ?></td> | |
<td><?php echo $result['horarioEntrada']; ?></td> | |
<td><?php echo $result['horarioSaida']; ?></td> | |
<td><?php echo $observacao; ?></td> | |
<td><a href=registros.php?id=<?php echo $result['idProfissional'];?> onClick="return confirma();">Registros</a></td> | |
<td><a href=delProf.php?id=<?php echo $result['idProfissional'];?> onClick="return confirmaDel();">Excluir tudo</a></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
<center> Nenhum registro encontrado! </center> | |
<?php } ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> | |
<script language="javascript"> | |
function confirmaDel(){ | |
var r = confirm("Tem certeza que deseja excluir esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?php | |
include "database.php"; | |
$idProfissional = $_POST["idProfissional"]; | |
$tipoTelefone = $_POST["tipoTelefone"]; | |
$operadora = $_POST["operadora"]; | |
$numero = $_POST["numero"]; | |
$tipoEmail = $_POST["tipoEmail"]; | |
$Email = $_POST["Email"]; | |
inserirContato($idProfissional, $tipoTelefone, $operadora, $numero, $tipoEmail, $Email); | |
$stmt = buscarContatoPorIdProfissional($idProfissional); | |
if ($stmt->rowCount() > 0){ | |
?> | |
<center><h3> Tabela de registros:</h3></center> | |
<Table> | |
<tr> | |
<th> Id Contato </th> | |
<th> Id Profissional </th> | |
<th> Tipo de telefone </th> | |
<th> Operadora </th> | |
<th> Número </th> | |
<th> Tipo de email </th> | |
<th> Email </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
?> | |
<tr> | |
<td><?php echo $result['idContato'];?></td> | |
<td><?php echo $result['idProfissional']; ?></td> | |
<td><?php echo $result['tipoTelefone'];?></td> | |
<td><?php echo $result['operadora'];?></td> | |
<td><?php echo $result['numero']; ?></td> | |
<td><?php echo $result['tipoEmail']; ?></td> | |
<td><?php echo $result['Email']; ?></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
Nenhum registro encontrado! | |
<?php } ?> | |
<div class="links"> | |
<a href="contato.php?id=<?php echo $idProfissional;?>">Adicionar Contato</a> | |
<a href="endereco.php?id=<?php echo $idProfissional;?>">Adicionar Endereco</a> | |
<a href="registros.php?id=<?php echo $idProfissional;?>" onClick="return confirma();">Exibir registros do Profissional</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<?php | |
include "database.php"; | |
?> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<form name='descricao' method='post' action='cadastroContato.php'> | |
<?php | |
echo "<input type='hidden' name='idProfissional' value='".$_GET['id']."'>"; | |
?> | |
<h3><label>Telefones</label></h3> | |
<label>Tipo:</label> | |
<select name="tipoTelefone" id="tipoTelefone"> | |
<option value="Celular">Celular</option> | |
<option value="Residencial">Residencial</option> | |
<option value="Comercial">Comercial</option> | |
</select> | |
<label>Operadora:</label> | |
<select name="operadora" id="operadora"> | |
<option value="Claro">Claro</option> | |
<option value="Tim">Tim</option> | |
<option value="Vivo">Vivo</option> | |
<option value="Oi">Oi</option> | |
<option value="Outra">Outra</option> | |
</select> | |
<label>Número:</label> | |
<input name='numero' type='text' id='numero' size='12' maxlength='60'> | |
<label> Emails</label> | |
<label>Tipo:</label> | |
<select name="tipoEmail" id="tipoEmail"> | |
<option value="emailPessoal">Pessoal</option> | |
<option value="emailComercial">Comercial</option> | |
</select> | |
<label>Email:</label> | |
<input name='Email' type='text' id='Email' size='32 ' maxlength='70'> | |
<br> | |
<input type='submit' value='Cadastrar'> | |
</form> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* CRUD - ISUD - by: Fabrício da Silva Dias | |
____________________________________________________________ | |
|| || | |
|| crud = [C]reate, [R]ead, [U]pdate e [D]elete ou Destroy || | |
|| isud = [I]NSERT, [S]ELECT, [U]pdate, [D]elete || | |
||__________________________________________________________|| | |
*/ | |
// Função para conexão com banco de dados. | |
function conexaoPDO(){ | |
#Iniciando conexão com banco de dados | |
$pdo = new PDO ('mysql:unix_socket=/opt/lampp/var/mysql/mysql.sock;dbname=CrudProfissional','root', ''); | |
$pdo->setattribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
return $pdo; | |
} | |
#função para atualizar \ Update das informações do Profissional. | |
function updateProfissional($nome, $idade, $nascimento, $sexo, $estadoCivil, $habilidade, $vinculo, $horarioEntrada , $horarioSaida, $observacao, $idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare( | |
'update Profissional '. | |
'set nome = :nome,'. | |
'idade = :idade,'. | |
'nascimento = :nascimento, '. | |
'sexo = :sexo, '. | |
'estadoCivil = :estadoCivil,'. | |
'habilidade = :habilidade, '. | |
'vinculo = :vinculo,'. | |
'horarioEntrada = :horarioEntrada,'. | |
'horarioSaida = :horarioSaida,'. | |
'observacao = :observacao '. | |
'where idProfissional = :idProfissional'); | |
$stmt->bindValue(":nome", $nome); | |
$stmt->bindValue(":idade", $idade); | |
$stmt->bindValue(":nascimento", $nascimento); | |
$stmt->bindValue(":sexo", $sexo); | |
$stmt->bindValue(":estadoCivil", $estadoCivil); | |
$stmt->bindValue(":habilidade", $habilidade); | |
$stmt->bindValue(":vinculo", $vinculo); | |
$stmt->bindValue(":horarioEntrada", $horarioEntrada); | |
$stmt->bindValue(":horarioSaida", $horarioSaida); | |
$stmt->bindValue(":observacao", $observacao); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
} | |
# Função de insert, usada para inserir dados no banco de dados. | |
function inserirProfissional($nome, $idade, $nascimento, $sexo, $estadoCivil, $habilidade, $vinculo, $horarioEntrada , $horarioSaida, $observacao){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare(' | |
INSERT INTO Profissional( | |
nome, | |
idade, | |
nascimento, | |
sexo, | |
estadoCivil, | |
habilidade, | |
vinculo, | |
horarioEntrada, | |
horarioSaida, | |
observacao | |
)VALUES( | |
:nome, | |
:idade, | |
:nascimento, | |
:sexo, | |
:estadoCivil, | |
:habilidade, | |
:vinculo, | |
:horarioEntrada, | |
:horarioSaida, | |
:observacao | |
);' | |
); | |
$stmt->bindValue(":nome", $nome); | |
$stmt->bindValue(":idade", $idade); | |
$stmt->bindValue(":nascimento", $nascimento); | |
$stmt->bindValue(":sexo", $sexo); | |
$stmt->bindValue(":estadoCivil", $estadoCivil); | |
$stmt->bindValue(":habilidade", $habilidade); | |
$stmt->bindValue(":vinculo", $vinculo); | |
$stmt->bindValue(":horarioEntrada", $horarioEntrada); | |
$stmt->bindValue(":horarioSaida", $horarioSaida); | |
$stmt->bindValue(":observacao", $observacao); | |
$stmt->execute(); | |
return $pdo->lastInsertId(); | |
} | |
# Função para efetuar buscas, essa função busca todos os profissionais. | |
function buscarTodosProfissionais(){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare("select * from Profissional;"); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#função para efetuar a deleção de um registro específicado pelo ID. | |
function deletarProf($id){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare('DELETE FROM Profissional WHERE idProfissional = :idProfissional;'); | |
$stmt->bindValue(":idProfissional", $id); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#função para efetuar buscas de registro específicado pelo ID; | |
function buscarProfissional($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare('SELECT FROM Profissional WHERE idProfissional = :idProfissional;'); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função de inserção, utilizada para inserir os dados preenchidos no formulario "endereço" na tabela "Endereco" do banco de dados. | |
function inserirEndereco($idProfissional, $cidade, $logradouro, $bairro, $numero, $tipoEndereco, $complemento , $cep, $uf){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare(' | |
INSERT INTO Endereco( | |
idProfissional, | |
cidade, | |
logradouro, | |
bairro, | |
numero, | |
tipoEndereco, | |
complemento, | |
cep, | |
uf | |
)VALUES( | |
:idProfissional, | |
:cidade, | |
:logradouro, | |
:bairro, | |
:numero, | |
:tipoEndereco, | |
:complemento, | |
:cep, | |
:uf | |
);' | |
); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->bindValue(":cidade", $cidade); | |
$stmt->bindValue(":logradouro", $logradouro); | |
$stmt->bindValue(":bairro", $bairro); | |
$stmt->bindValue(":numero", $numero); | |
$stmt->bindValue(":tipoEndereco", $tipoEndereco); | |
$stmt->bindValue(":complemento", $complemento); | |
$stmt->bindValue(":cep", $cep); | |
$stmt->bindValue(":uf", $uf); | |
$stmt->execute(); | |
$pdo = null; | |
} | |
#Função de inserção, utilizada para inserir os dados preenchidos no formulario "Contato" na tabela "Contato" do banco de dados. | |
function inserirContato($idProfissional, $tipoTelefone, $operadora, $numero, $tipoEmail, $Email){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare(' | |
INSERT INTO Contato( | |
idProfissional, | |
tipoTelefone, | |
operadora, | |
numero, | |
tipoEmail, | |
)VALUES( | |
:idProfissional, | |
:tipoTelefone, | |
:operadora, | |
:numero, | |
:tipoEmail, | |
);' | |
); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->bindValue(":tipoTelefone", $tipoTelefone); | |
$stmt->bindValue(":operadora", $operadora); | |
$stmt->bindValue(":numero", $numero); | |
$stmt->bindValue(":tipoEmail", $tipoEmail); | |
$stmt->bindValue(":Email", $Email); | |
$stmt->execute(); | |
$pdo = null; | |
} | |
#Função para buscar todos os endereços, sem especificação. | |
function buscarTodosEnderecos(){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare("select * from Endereco;"); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para buscar todos os Contatos, sem especificação. | |
function buscarTodosContatos(){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare("select * from Contato;"); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para buscar os registros de profissionais especificos utilizando ID do profissional. | |
function buscarProfissionalPorID($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare('select * from Profissional WHERE idProfissional = :idProfissional;'); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para buscar os registros de Endereços especificos utilizando ID do Endereco. | |
function buscarEnderecoPorID($idEndereco){ | |
$pdo = conexaoPDO(); | |
$stm = $pdo->prepare("select * from Endereco WHERE idEndereco = :idEndereco;"); | |
$stm->bindValue(":idEndereco", $idEndereco); | |
$stm->execute(); | |
$pdo = null; | |
return $stm; | |
} | |
#Função para buscar os registros de endereço por ID do Profissional. | |
function buscarEnderecoPorIdProfissional($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stm = $pdo->prepare("select * from Endereco WHERE idProfissional = :idProfissional;"); | |
$stm->bindValue(":idProfissional", $idProfissional); | |
$stm->execute(); | |
$pdo = null; | |
return $stm; | |
} | |
#Função para efetuar a deleção de endereço especificado pelo ID do Profissional | |
function deletarEndereco($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare('DELETE FROM Endereco WHERE idEndereco = :idProfissional;'); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para efetuar a deleção de Contato especificado pelo ID do Profissional | |
function deletarContato($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare('DELETE FROM Contato WHERE idContato = :idProfissional;'); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função utilizada para atualizar(Update) Endereco. | |
function atualizar($cidade, $logradouro, $bairro, $numero, $tipoEndereco, $complemento , $cep, $uf, $idEndereco){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare( | |
'update Endereco '. | |
'set cidade = :cidade,'. | |
'logradouro = :logradouro,'. | |
'bairro = :bairro, '. | |
'numero = :numero, '. | |
'complemento = :complemento,'. | |
'tipoEndereco = :tipoEndereco, '. | |
'cep = :cep,'. | |
'uf = :uf '. | |
'where idEndereco = :idEndereco'); | |
$stmt->bindValue(":cidade", $cidade); | |
$stmt->bindValue(":logradouro", $logradouro); | |
$stmt->bindValue(":bairro", $bairro); | |
$stmt->bindValue(":numero", $numero); | |
$stmt->bindValue(":complemento", $complemento); | |
$stmt->bindValue(":tipoEndereco", $tipoEndereco); | |
$stmt->bindValue(":cep", $cep); | |
$stmt->bindValue(":uf", $uf); | |
$stmt->bindValue(":idEndereco", $idEndereco); | |
$stmt->execute(); | |
$pdo = null; | |
} | |
#Função utilizada para atualizar(Update) Contato. | |
function updateContato($tipoTelefone, $operadora, $numero, $tipoEmail, $Email, $idContato){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare( | |
'update Contato '. | |
'set tipoTelefone = :tipoTelefone, '. | |
'operadora = :operadora, '. | |
'numero = :numero, '. | |
'tipoEmail = :tipoEmail, '. | |
'Email = :Email '. | |
'where idContato = :idContato'); | |
$stmt->bindValue(":tipoTelefone", $tipoTelefone); | |
$stmt->bindValue(":operadora", $operadora); | |
$stmt->bindValue(":numero", $numero); | |
$stmt->bindValue(":tipoEmail", $tipoEmail); | |
$stmt->bindValue(":Email", $Email); | |
$stmt->bindValue(":idContato", $idContato); | |
$stmt->execute(); | |
$pdo = null; | |
} | |
#Função para efetuar buscas de contato por ID do contato. | |
function buscarContatoPorID($idContato){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare("select * from Contato WHERE idContato = :idContato;"); | |
$stmt->bindValue(":idContato", $idContato); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para efetuar buscas de contato por ID do Profissional. | |
function buscarContatoPorIdProfissional($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stmt = $pdo->prepare("select * from Contato WHERE idProfissional = :idProfissional;"); | |
$stmt->bindValue(":idProfissional", $idProfissional); | |
$stmt->execute(); | |
$pdo = null; | |
return $stmt; | |
} | |
#Função para efetuar buscas de contato por ID do Profissional (Diferencia da anterior apenas no retorno). | |
function buscarContatoPorIdProfissionalStm($idProfissional){ | |
$pdo = conexaoPDO(); | |
$stm = $pdo->prepare("select * from Contato WHERE idProfissional = :idProfissional;"); | |
$stm->bindValue(":idProfissional", $idProfissional); | |
$stm->execute(); | |
$pdo = null; | |
return $stm; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop database CrudProfissional; | |
create database CrudProfissional; | |
use CrudProfissional; | |
-- Tabela para armazenamento dos dados do Profissional. | |
CREATE TABLE Profissional ( | |
idProfissional int NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
nome VARCHAR(30) NOT NULL, | |
idade VARCHAR(3) NOT NULL, | |
nascimento DATE NOT NULL, | |
sexo CHAR(1) NOT NULL, | |
estadoCivil VARCHAR(15) NOT NULL, | |
habilidade VARCHAR(40), | |
vinculo VARCHAR(15) NOT NULL, | |
horarioEntrada VARCHAR(10), | |
horarioSaida VARCHAR(10), | |
observacao VARCHAR(500) | |
); | |
-- Tabela para armazenamento dos dados de Endereco do Profissional. | |
CREATE TABLE Endereco ( | |
idEndereco int NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
idProfissional int NOT NULL, | |
logradouro VARCHAR(30), | |
cidade VARCHAR(30) NOT NULL, | |
bairro VARCHAR(30) NOT NULL, | |
numero VARCHAR(4) NOT NULL, | |
tipoEndereco VARCHAR(15)NOT NULL, | |
complemento VARCHAR(30), | |
cep VARCHAR(9) NOT NULL, | |
uf VARCHAR(2) NOT NULL | |
); | |
-- Tabela para armazenamento dos dados de contato do Profissional. | |
CREATE TABLE Contato ( | |
idContato int NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
idProfissional int NOT NULL, | |
tipoTelefone VARCHAR(15)NOT NULL, | |
operadora VARCHAR(15)NOT NULL, | |
numero varchar(15) NOT NULL, | |
tipoEmail VARCHAR(15)NOT NULL, | |
Email VARCHAR(30)NOT NULL | |
); | |
-- Alterações posterior a criação das tabelas, processo de inclusão de chaves estrangeiras. | |
-- A inclusão da chave "IdProfissional" na tabela de Endereços; | |
ALTER TABLE Endereco | |
ADD CONSTRAINT fk_Profissional_Endereco | |
FOREIGN KEY (idProfissional) REFERENCES Profissional (idProfissional) ; | |
-- A inclusão da chave "IdProfissional" na tabela de Contato; | |
ALTER TABLE Contato | |
ADD CONSTRAINT fk_Profissional_Contato | |
FOREIGN KEY (idProfissional) REFERENCES Profissional (idProfissional) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf8"> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?PHP | |
include "database.php"; | |
// $idContato = $_GET['id']; | |
$idProfissional = $_GET["id"]; | |
$stmt = deletarContato($idProfissional); | |
buscarContatoPorIdProfissionalStm($idProfissional); | |
if ($stmt->rowCount() > 0){ | |
//Caso a função rowCount > 0, então o registro foi deletado com sucesso, ou seja, tinha conteúdo | |
?> | |
<h4><center> Cadastro deletado com sucesso!</center></h4> | |
<?php }else{ | |
//Else, siguinifica que a função rowCount retornou 0, ou seja, não existe um registro com o id especificado via parametro. | |
?> | |
<h4><center>Cadastro inexistente!</center></h4> | |
<?php } ?> | |
<center><a href="buscarProf.php">Voltar </a></center> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf8"> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?PHP | |
include "database.php"; | |
$idProfissional = $_GET['id']; | |
$stmt = deletarEndereco($idProfissional); | |
if ($stmt->rowCount() > 0){ | |
//Caso a função rowCount > 0, então o registro foi deletado com sucesso, ou seja, tinha conteúdo | |
?> | |
<h4><center> Cadastro deletado com sucesso!</center></h4> | |
<?php }else{ | |
//Else, siguinifica que a função rowCount retornou 0, ou seja, não existe um registro com o id especificado via parametro. | |
?> | |
<h4><center>Cadastro inexistente!</center></h4> | |
<?php } ?> | |
<center><a href="buscarProf.php">Voltar</a></center> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf8"> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?PHP | |
include "database.php"; | |
$id = $_GET['id']; | |
$stmt = deletarProf($id); | |
if ($stmt->rowCount() > 0){ | |
//Caso a função rowCount > 0, então o registro foi deletado com sucesso, ou seja, tinha conteúdo | |
?> | |
<h4><center> Cadastro deletado com sucesso!</center></h4> | |
<?php }else{ | |
//Else, siguinifica que a função rowCount retornou 0, ou seja, não existe um registro com o id especificado via parametro. | |
?> | |
<h4><center>Cadastro inexistente!</center></h4> | |
<?php } ?> | |
<center><a href="buscarProf.php">Voltar</a></center> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
<script language="javascript"> | |
function confirmaEdit(){ | |
var r = confirm("Tem certeza que deseja editar esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?php | |
include "database.php"; | |
$idContato = $_GET['id']; | |
$stm = buscarContatoPorID($idContato); | |
$stm = $stm->fetch(); | |
if(empty($stm)){ | |
?> | |
Registro não localizado na base de dados! | |
<?php | |
}else{ ?> | |
<form name='descricao' method='post' action='updateContato.php' onsubmit='return RegistroProf();'> | |
<?php | |
echo "<input type='hidden' name='idContato' value='".$_GET['id']."'>"; | |
?> | |
<h2><label>Telefones</label></h2> | |
<label>Tipo:</label> | |
<select name="tipoTelefone" id="tipoTelefone"> | |
<option <?php if ($stm['tipoTelefone'] == 'Celular') echo 'selected';?> value="Celular">Celular</option> | |
<option <?php if ($stm['tipoTelefone'] == 'Residencial') echo 'selected';?> value="Residencial">Residencial</option> | |
<option <?php if ($stm['tipoTelefone'] == 'Comercial') echo 'selected';?> value="Comercial">Comercial</option> | |
</select> | |
<label>Operadora:</label> | |
<select name="operadora" id="operadora"> | |
<option <?php if ($stm['operadora'] == 'Claro') echo 'selected';?> value="Claro">Claro</option> | |
<option <?php if ($stm['operadora'] == 'Tim') echo 'selected';?> value="Tim">Tim</option> | |
<option <?php if ($stm['operadora'] == 'Vivo') echo 'selected';?> value="Vivo">Vivo</option> | |
<option <?php if ($stm['operadora'] == 'Oi') echo 'selected';?> value="Oi">Oi</option> | |
<option <?php if ($stm['operadora'] == 'Outra') echo 'selected';?> value="Outra">Outra</option> | |
</select> | |
<label>Numero:</label> | |
<input name="numero" type="text" id="numero" size="25" maxlength="60" value="<?php echo $stm['numero'] ; ?>" /> | |
<h2><label>Emails</label></h2> | |
<label>Tipo:</label> | |
<select name="tipoEmail" id="tipoEmail"> | |
<option <?php if ($stm['tipoEmail'] == 'emailPessoal') echo 'selected';?> value="emailPessoal">Pessoal</option> | |
<option <?php if ($stm['tipoEmail'] == 'emailComercial') echo 'selected';?> value="emailComercial">Comercial</option> | |
</select> | |
<label>Email:</label> | |
<input name="Email" type="text" id="Email" size="48" maxlength="60" value="<?php echo $stm['Email'] ; ?>" /> | |
<br> | |
<input type='submit' value='Atualizar' onClick="return confirmaEdit();"> | |
</form> | |
<?php | |
} | |
?> | |
</div> | |
</div> | |
</div> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
<script language='javascript'> | |
function confirmaEditar(){ | |
var r = confirm("Tem certeza que deseja modificar esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?php | |
include "database.php"; | |
$idEndereco = $_GET['id']; | |
$stm = buscarEnderecoPorID($idEndereco); | |
$stm = $stm->fetch(); | |
if(empty($stm)){ | |
?> | |
Registro não localizado na base de dados! | |
<?php | |
}else{ ?> | |
<form name='descricao' method='post' action='updateEndereco.php' onsubmit='return tipoEndereco();'> | |
<?php | |
echo "<input type='hidden' name='idEndereco' value='".$_GET['id']."'>"; | |
?> | |
<h3><center>Endereço</center></h3> | |
<label>Estado:</label> | |
<select name="uf" id="uf"> | |
<option <?php if ($stm['uf'] == 'AC') echo 'selected';?> value="AC">AC</option> | |
<option <?php if ($stm['uf'] == 'AL') echo 'selected';?> value="AL">AL</option> | |
<option <?php if ($stm['uf'] == 'AP') echo 'selected';?> value="AP">AP</option> | |
<option <?php if ($stm['uf'] == 'AM') echo 'selected';?> value="AM">AM</option> | |
<option <?php if ($stm['uf'] == 'BA') echo 'selected';?> value="BA">BA</option> | |
<option <?php if ($stm['uf'] == 'CE') echo 'selected';?> value="CE">CE</option> | |
<option <?php if ($stm['uf'] == 'DF') echo 'selected';?> value="DF">DF</option> | |
<option <?php if ($stm['uf'] == 'ES') echo 'selected';?> value="ES">ES</option> | |
<option <?php if ($stm['uf'] == 'GO') echo 'selected';?> value="GO">GO</option> | |
<option <?php if ($stm['uf'] == 'MA') echo 'selected';?> value="MA">MA</option> | |
<option <?php if ($stm['uf'] == 'MT') echo 'selected';?> value="MT">MT</option> | |
<option <?php if ($stm['uf'] == 'MS') echo 'selected';?> value="MS">MS</option> | |
<option <?php if ($stm['uf'] == 'MG') echo 'selected';?> value="MG">MG</option> | |
<option <?php if ($stm['uf'] == 'PA') echo 'selected';?> value="PA">PA</option> | |
<option <?php if ($stm['uf'] == 'PB') echo 'selected';?> value="PB">PB</option> | |
<option <?php if ($stm['uf'] == 'PR') echo 'selected';?> value="PR">PR</option> | |
<option <?php if ($stm['uf'] == 'PE') echo 'selected';?> value="PE">PE</option> | |
<option <?php if ($stm['uf'] == 'PI') echo 'selected';?> value="PI">PI</option> | |
<option <?php if ($stm['uf'] == 'RJ') echo 'selected';?> value="RJ">RJ</option> | |
<option <?php if ($stm['uf'] == 'RN') echo 'selected';?> value="RN">RN</option> | |
<option <?php if ($stm['uf'] == 'RS') echo 'selected';?> value="RS">RS</option> | |
<option <?php if ($stm['uf'] == 'RO') echo 'selected';?> value="RO">RO</option> | |
<option <?php if ($stm['uf'] == 'RR') echo 'selected';?> value="RR">RR</option> | |
<option <?php if ($stm['uf'] == 'SC') echo 'selected';?> value="SC">SC</option> | |
<option <?php if ($stm['uf'] == 'SP') echo 'selected';?> value="SP">SP</option> | |
<option <?php if ($stm['uf'] == 'SE') echo 'selected';?> value="SE">SE</option> | |
<option <?php if ($stm['uf'] == 'TO') echo 'selected';?> value="TO">TO</option> | |
</select> | |
<label>Cidade:</label> | |
<input name="cidade" type="text" id="cidade" size="33" maxlength="60" value="<?php echo $stm['cidade'] ; ?>" /> | |
<label>Bairro:</label> | |
<input name='bairro' type='text'size='10' id='bairro' value='<?php echo $stm['bairro'] ; ?> '> | |
<label>Número:</label> | |
<input name='numero' type='text'size='5' maxlength='6' id='numero' value='<?php echo $stm['numero'] ; ?> '> | |
<label>Tipo:</label> | |
<select name="tipoEndereco" id="tipoEndereco"> | |
<option <?php if ($stm['tipoEndereco'] == 'Residencial') echo 'selected'; ?> value="residencial">Residencial</option> | |
<option <?php if ($stm['tipoEndereco'] == 'Comercial') echo 'selected'; ?> value="comercial">Comercial</option> | |
</select> | |
<label>Logradouro:</label> | |
<input name='logradouro' type='text'size='10' maxlength='30 ' id='logradouro' value='<?php echo $stm ['logradouro'] ; ?> '> | |
<label>Complemento:</label> | |
<input name='complemento' type='text'size='14' id='complemento' value='<?php echo $stm ['complemento'] ; ?> '> | |
<label>Cep:</label> | |
<input name='cep' type='text'size='17' id='cep' value='<?php echo $stm ['cep'] ; ?> '> | |
<br> | |
<input type='submit' value='Efetuar edição' onClick='return confirmaEditar();'> | |
</form> | |
<?php } ?> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<?php | |
include "database.php"; | |
?> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<form name='descricao' method='post' action='RegistroEndereco.php' onsubmit='return tipoEndereco();'> | |
<?php | |
echo "<input type='hidden' name='idProfissional' value='".$_GET['id']."'>"; | |
?> | |
<h3><label>Cadastro de endereço</label></h3> | |
<label>Estado:</label> | |
<select name="uf" id="uf"> | |
<option value="AC">AC</option> | |
<option value="AL">AL</option> | |
<option value="AP">Ap</option> | |
<option value="AM">AM</option> | |
<option value="BA">BA</option> | |
<option value="CE">CE</option> | |
<option value="DF">DF</option> | |
<option value="ES">ES</option> | |
<option value="GO">GO</option> | |
<option value="MA">MA</option> | |
<option value="MT">MT</option> | |
<option value="MS">MS</option> | |
<option value="MG">MG</option> | |
<option value="PA">PA</option> | |
<option value="PB">PB</option> | |
<option value="PR">PR</option> | |
<option value="PE">PE</option> | |
<option value="PI">PI</option> | |
<option value="RJ">RJ</option> | |
<option value="RN">RN</option> | |
<option value="RS">RS</option> | |
<option value="RO">RO</option> | |
<option value="RR">RR</option> | |
<option value="SC">SC</option> | |
<option value="SP">SP</option> | |
<option value="SE">SE</option> | |
<option value="TO">TO</option> | |
</select> | |
<label>Cidade:</label> | |
<input name='cidade' type='text' id='cidade' size='37' maxlength='60'> | |
<label>Logradouro:</label> | |
<input name='logradouro' type='text'size='10' maxlength='30 ' id='logradouro'> | |
<label>Bairro:</label> | |
<input name='bairro' type='text'size='25' id='bairro'> | |
<label>Número:</label> | |
<input name='numero' type='text'size='5' maxlength='6' id='numero'> | |
<label>Tipo:</label> | |
<select name="tipoEndereco" id="tipoEndereco"> | |
<option value="residencial">Residencial</option> | |
<option value="comercial">Comercial</option> | |
</select> | |
<label>Complemento:</label> | |
<input name='complemento' type='text'size='5' id='complemento'> | |
<label>Cep:</label> | |
<input name='cep' type='text' id='cep'> | |
<br> | |
<input type='submit' value='Cadastrar'> | |
</form> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf8"> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> | |
<script language='javascript'> | |
function validarCadastro(){ | |
if(document.CadastrarProfissional.nome.value.trim()==""){ | |
alert("Por favor, preencha o campo nome!"); | |
document.CadastrarProfissional.nome.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.nascimento.value.trim()== ""){ | |
alert("Por favor, preencha o campo Data de Nascimento!"); | |
document.CadastrarProfissional.nascimento.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.sexo.value.trim()==""){ | |
alert("Por favor, preencha o campo Sexo!"); | |
document.CadastrarProfissional.sexo.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.estadoCivil.value.trim()==""){ | |
alert("Por favor, preencha o campo Estado Civil!"); | |
document.CadastrarProfissional.estadoCivil.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.horarioEntrada.value.trim()==""){ | |
alert("Por favor, preencha o campo Horário de entrada!"); | |
document.CadastrarProfissional.horarioEntrada.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.horarioSaida.value.trim()==""){ | |
alert("Por favor, preencha o campo horario de saida!"); | |
document.CadastrarProfissional.horarioSaida.focus(); | |
return false; | |
} | |
} | |
function calcularIdade(valor){ | |
var campo1 = document.getElementById("ano").value; | |
var resultado = parseInt(campo1); | |
resultado = 2016-campo1; | |
document.getElementById('idade').value = resultado; | |
} | |
function SomenteNumero(e){ | |
var tecla=(window.event)?event.keyCode:e.which; | |
if((tecla>47 && tecla<58)) return true; | |
else{ | |
if (tecla==8 || tecla==0) return true; | |
else return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<div class="form"> | |
<form name='CadastrarProfissional' method='post' action='registroProf.php' onsubmit='return validarCadastro();'> | |
<label for="Nome:">Nome: </label> | |
<input name='nome' type='text' id='nome' size='65' maxlength='50' placeholder="Insira seu nome completo"> | |
<label>Nascimento:</label> | |
<input name='nascimento[0]' type='text' size='3' maxlength='2' id="dia" placeholder="Dia" onkeypress="return SomenteNumero(event);" > / | |
<input name='nascimento[1]' type='text' size='3' maxlength='2' id="mes" placeholder="Mês" onkeypress="return SomenteNumero(event);" > / | |
<input name='nascimento[2]' type='text' size='7' maxlength='4' id="ano" placeholder="Ano" onChange="calcularIdade(this.value);"/> | |
<label>Idade:</label> | |
<input name='idade' type='text' size='8' maxlength='3' id="idade" placeholder="Idade" onChange='CalcularIdade(this.value);'onkeypress="return SomenteNumero(event);"> | |
<label>Sexo:</label> | |
<select name="sexo" id="sexo"> | |
<option value="M">Masculino</option> | |
<option value="F">Feminino</option> | |
</select> | |
<label>Estado Civil:</label> | |
<select name="estadoCivil" id="estadoCivil"> | |
<option value="solteiro">Solteiro</option> | |
<option value="casado">Casado</option> | |
<option value="divorciado">Divorciado</option> | |
<option value="separado">Separado</option> | |
<option value="viuvo">Viuvo</option> | |
</select> | |
<label>Vínculo:</label> | |
<select name="vinculo" id="vinculo"> | |
<option value="CLT">CLT</option> | |
<option value="Temporario">Temporário</option> | |
</select> | |
<label>Horário de entrada:</label> | |
<input name='horarioEntrada' type='text'size='3' maxlength='5' id='horarioEntrada' placeholder="12:00" /> | |
<label>Horário de saída:</label> | |
<input name='horarioSaida' type='text' size='3' maxlength='5' id='horarioSaida' placeholder="12:00" /> | |
<label>Habilidades:</label> | |
<input type="checkbox" name="habilidade[0]" value="Html">HTML | |
<input type="checkbox" name="habilidade[1]" value="Css">CSS | |
<input type="checkbox" name="habilidade[2]" value="Javascript">Javascript | |
<input type="checkbox" name="habilidade[3]" value="Php">PHP | |
<input type="checkbox" name="habilidade[4]" value="BancoDados">Banco de dados | |
<label>Observações:</label> | |
<textarea rows="6" name='observacao' id='observacao' placeholder="O preenchimento deste campo não é obrigatório!"></textarea> | |
<input type='submit' value='Cadastrar'/> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?php | |
include "database.php"; | |
$idProfissional = $_POST["idProfissional"]; | |
$cidade = $_POST["cidade"]; | |
$logradouro = $_POST["logradouro"]; | |
$bairro = $_POST["bairro"]; | |
$numero = $_POST["numero"]; | |
$tipoEndereco = $_POST["tipoEndereco"]; | |
$complemento = $_POST["complemento"]; | |
$cep = $_POST["cep"]; | |
$uf = $_POST["uf"]; | |
#Função de inserção - Escrita no script (database.php) | |
inserirEndereco($idProfissional, $cidade, $logradouro, $bairro, $numero, $tipoEndereco, $complemento , $cep, $uf); | |
# A utilização da chave estrangeira como parâmetro dessa função, é motivada pela possibilidade de um único profissional possuir N endereços. | |
$stmt = buscarEnderecoPorIdProfissional($idProfissional); | |
?> | |
<?php | |
if ($stmt->rowCount() > 0){ ?> | |
<h3> Endereco inserido com sucesso!</h3> | |
<Table> | |
<tr> | |
<th> Id Endereço </th> | |
<th> id Profissional </th> | |
<th> Cidade </th> | |
<th> Logradouro </th> | |
<th> Bairro </th> | |
<th> Número </th> | |
<th> Tipo de Endereco </th> | |
<th> Complemento </th> | |
<th> Cep </th> | |
<th> UF </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
?> | |
<tr> | |
<td><?php echo $result['idEndereco'];?></td> | |
<td><?php echo $result['idProfissional'];?></td> | |
<td><?php echo $result['cidade'];?></td> | |
<td><?php echo $result['logradouro'];?></td> | |
<td><?php echo $result['bairro'];?></td> | |
<td><?php echo $result['numero']; ?></td> | |
<td><?php echo $result['tipoEndereco'];?></td> | |
<td><?php echo $result['complemento']; ?></td> | |
<td><?php echo $result['cep']; ?></td> | |
<td><?php echo $result['uf'];?></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
Nenhum registro encontrado! | |
<?php } ?> | |
<div class="links"> | |
<a href="endereco.php?id=<?php echo $idProfissional;?>">Adicionar Endereco</a> | |
<a href="contato.php?id=<?php echo $idProfissional;?>">Adicionar Contato</a> | |
<a href="registros.php?id=<?php echo $idProfissional;?>" onClick="return confirma();">Exibir registros do Profissional</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<div class="tabela"> | |
<?php | |
include "database.php"; | |
# Este script faz a interface com o banco de dados, inserindo ou atualizando os dados do profissional na tabela Profissional | |
# Neste trecho é pego do POST os dados enviados do formulario do profissional | |
$nome = $_POST["nome"]; | |
$idade = $_POST["idade"]; | |
$nascimento = $_POST["nascimento"]; | |
$sexo = $_POST["sexo"]; | |
$estadoCivil = $_POST["estadoCivil"]; | |
$habilidade = $_POST["habilidade"]; | |
$vinculo = $_POST["vinculo"]; | |
$horarioEntrada = $_POST["horarioEntrada"]; | |
$horarioSaida = $_POST["horarioSaida"]; | |
$observacao = $_POST["observacao"]; | |
# A primeira função implode está separando o array por vírgula. | |
# A segunda está fazendo a separação por barra. | |
$habilidade = implode(",", $habilidade); | |
$nascimento = implode("/",array_reverse($nascimento)); | |
$idProfissional = inserirProfissional($nome, $idade, $nascimento, $sexo, $estadoCivil, $habilidade, $vinculo, $horarioEntrada , $horarioSaida, $observacao); | |
?> | |
<center><h3> Tabela de registros:</h3></center> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id </th> | |
<th> Nome </th> | |
<th> Idade </th> | |
<th> Nascimento </th> | |
<th> Sexo </th> | |
<th> Estado Civil </th> | |
<th> Habilidades </th> | |
<th> Vínculo </th> | |
<th> Horario de Entrada </th> | |
<th> Horário de Saida </th> | |
<th> Observações </th> | |
<th> Endereço </th> | |
<th> Contato </th> | |
</tr> | |
<?php | |
$habilidade = implode('<br>',array_reverse(explode(',',$habilidade))); | |
$observacao = implode('<p>',array_reverse(explode(',',$observacao))); | |
?> | |
<tr> | |
<td><?php echo $idProfissional; ?></td> | |
<td><?php echo $nome?></td> | |
<td><?php echo $idade;?></td> | |
<td><?php echo $nascimento = implode("/", array_reverse(explode("/", $nascimento)));?> | |
<td><?php echo $sexo; ?></td> | |
<td><?php echo $estadoCivil; ?></td> | |
<td><?php echo $habilidade; ?></td> | |
<td><?php echo $vinculo;?></td> | |
<td><?php echo $horarioEntrada; ?></td> | |
<td><?php echo $horarioSaida; ?></td> | |
<td><?php echo $observacao; ?></td> | |
<td><a href="endereco.php?id=<?php echo $idProfissional;?>" onClick="return confirma();">Cadastrar Endereço </a></td> | |
<td><a href="contato.php?id=<?php echo $idProfissional;?>" onClick="return confirma();">Cadastrar Contato </a></td> | |
</tr> | |
</Table> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> | |
<script language="javascript"> | |
function confirmaDel(){ | |
var r = confirm("Tem certeza que deseja excluir esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<div class="tabela"> | |
<?php | |
include "database.php"; | |
$idProfissional = $_GET["id"]; | |
$stmt = buscarProfissionalPorID($idProfissional); | |
$stm = buscarEnderecoPorIdProfissional($idProfissional); | |
$st = buscarContatoPorIdProfissional($idProfissional); | |
?> | |
<center> | |
<?php | |
if ($stmt->rowCount() > 0){ ?> | |
<h4> Profissional:</h4> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id </th> | |
<th> Nome </th> | |
<th> Idade </th> | |
<th> Nascimento </th> | |
<th> Sexo </th> | |
<th> Estado Civil </th> | |
<th> Habilidade </th> | |
<th> vinculo </th> | |
<th> Horario de Entrada </th> | |
<th> Horario de Saida </th> | |
<th> Observação </th> | |
<th> Editar </th> | |
<th> Excluir </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
$nascimento = $result['nascimento']; | |
$habilidade = $result['habilidade']; | |
$habilidade = implode('<br>',array_reverse(explode(',',$habilidade))); | |
$observacao = $result['observacao']; | |
$observacao = implode('<p>',array_reverse(explode(',',$observacao))); | |
?> | |
<tr> | |
<td><?php echo $result['idProfissional']; ?></td> | |
<td><?php echo $result['nome'];?></td> | |
<td><?php echo $result['idade'];?></td> | |
<td><?php echo $nascimento = implode('/',array_reverse(explode('-',$nascimento)));?></td> | |
<td><?php echo $result['sexo']; ?></td> | |
<td><?php echo $result['estadoCivil']; ?></td> | |
<td><?php echo $habilidade; ?></td> | |
<td><?php echo $result['vinculo']; ?></td> | |
<td><?php echo $result['horarioEntrada']; ?></td> | |
<td><?php echo $result['horarioSaida']; ?></td> | |
<td><?php echo $observacao; ?></td> | |
<td><a href=reProfissional.php?id=<?php echo $idProfissional;?> onClick="return confirma();">Editar</a></td> | |
<td><a href=delProf.php?id=<?php echo $idProfissional;?> onClick="return confirmaDel();">Excluir</a></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
<br><br> | |
<center> Nenhum registro encontrado! </center> | |
<?php } ?> | |
<?php | |
if ($stm->rowCount() > 0){ ?> | |
<h4> Endereço:</h4> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id Endereco </th> | |
<th> id Profissional </th> | |
<th> Cidade </th> | |
<th> Logradouro </th> | |
<th> Bairro </th> | |
<th> Número </th> | |
<th> Tipo de Endereco </th> | |
<th> Complemento </th> | |
<th> Cep </th> | |
<th> UF </th> | |
<th> Editar </th> | |
<th> Excluir </th> | |
</tr> | |
<?php | |
while($return = $stm->fetch()){ | |
?> | |
<tr> | |
<td><?php echo $return['idEndereco'];?></td> | |
<td><?php echo $return['idProfissional'];?></td> | |
<td><?php echo $return['cidade'];?></td> | |
<td><?php echo $return['logradouro'];?></td> | |
<td><?php echo $return['bairro'];?></td> | |
<td><?php echo $return['numero']; ?></td> | |
<td><?php echo $return['tipoEndereco'];?></td> | |
<td><?php echo $return['complemento']; ?></td> | |
<td><?php echo $return['cep']; ?></td> | |
<td><?php echo $return['uf'];?></td> | |
<td><a href=editarEnd.php?id=<?php echo $return['idEndereco'];?>>Editar </a></td> | |
<td><a href=delEnd.php?id=<?php echo $return['idEndereco'];?> onClick="return confirmaDel();">Excluir </a></td> | |
</tr> | |
<?php | |
} ?> | |
</Table> | |
<?php }else{ ?> | |
<br><br> | |
<center> Nenhum registro encontrado!</center> | |
<br><br> | |
<?php } ?> | |
<br><a href=endereco.php?id=<?php echo $idProfissional;?>>Adicionar Endereco</a> | |
<?php | |
if ($st->rowCount() > 0){ ?> | |
<h4> Contato:</h4> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id Contato </th> | |
<th> id Profissional </th> | |
<th> Tipo de Telefone </th> | |
<th> Operadora </th> | |
<th> Número </th> | |
<th> Tipo de Email </th> | |
<th> Endereço de Email </th> | |
<th> Editar</th> | |
<th> Excluir </th> | |
</tr> | |
<?php | |
while ($return = $st->fetch(PDO::FETCH_ASSOC)) { | |
?> | |
<tr> | |
<td><?php echo $return['idContato'];?></td> | |
<td><?php echo $return['idProfissional'];?></td> | |
<td><?php echo $return['tipoTelefone'];?></td> | |
<td><?php echo $return['operadora'];?></td> | |
<td><?php echo $return['numero'];?></td> | |
<td><?php echo $return['tipoEmail']; ?></td> | |
<td><?php echo $return['Email']; ?></td> | |
<td><a href=editarContato.php?id=<?php echo $return['idContato'];?>>Editar </a></td> | |
<td><a href=delContato.php?id=<?php echo $return['idContato'];?> onClick="return confirmaDel();">Excluir </a></td> | |
</tr> | |
<?php | |
} | |
?> | |
</Table> | |
<?php }else{ ?> | |
<br><br> | |
<center> Nenhum registro encontrado!<br> | |
</center> | |
<?php } ?> | |
<br><a href=contato.php?id=<?php echo $idProfissional;?> onClick="return confirma();">Cadastrar Contato </a> | |
</center> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<script language='javascript'> | |
function validarCadastro(){ | |
if(document.CadastrarProfissional.nome.value.trim()==""){ | |
alert("Por favor, preencha o campo nome!"); | |
document.CadastrarProfissional.nome.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.nascimento.value.trim()== ""){ | |
alert("Por favor, preencha o campo Data de Nascimento!"); | |
document.CadastrarProfissional.nascimento.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.sexo.value.trim()==""){ | |
alert("Por favor, preencha o campo Sexo!"); | |
document.CadastrarProfissional.sexo.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.estadoCivil.value.trim()==""){ | |
alert("Por favor, preencha o campo Estado Civil!"); | |
document.CadastrarProfissional.estadoCivil.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.horarioEntrada.value.trim()==""){ | |
alert("Por favor, preencha o campo Horário de entrada!"); | |
document.CadastrarProfissional.horarioEntrada.focus(); | |
return false; | |
} | |
if(document.CadastrarProfissional.horarioSaida.value.trim()==""){ | |
alert("Por favor, preencha o campo horario de saida!"); | |
document.CadastrarProfissional.horarioSaida.focus(); | |
return false; | |
} | |
} | |
function calcularIdade(valor){ | |
var campo1 = document.getElementById("nascimento").value; | |
var resultado = parseInt(campo1); | |
resultado = 2016-campo1; | |
document.getElementById('idade').value = resultado; | |
} | |
</script> | |
<?php | |
include "database.php"; | |
$idProfissional = $_GET["id"]; | |
$stmt = buscarProfissionalPorID($idProfissional); | |
$stmt = $stmt->fetch(); | |
$habilidade = explode(",", $stmt['habilidade']); #Explode separa os itens do array, nesse caso em vígula; | |
$nascimento = $stmt['nascimento'] ; | |
$nascimento = implode('/',array_reverse(explode('-',$nascimento))); # O array está tendo sua posição invertida pelo "array_reverse" . | |
$anoNascimento = substr($nascimento, -4); #substr, nesse caso está sendo utilizada para pegar apenas os ultimos 4 dígitos dos dados armazenados na variável $nascimento. | |
$idade = 2016 - $anoNascimento; | |
#print_r ($anoNascimento); | |
#print_ ($idade); | |
#$data = DateTime::createFromFormat("Y-m-d", $stmt['nascimento']); | |
#echo $data->format('Y'); | |
#Página para de edição de dados transcritos no formulario de cadastro. | |
if(empty($stmt)){ | |
?> | |
Registro não localizado na base de dados! | |
<?php | |
}else{ | |
?> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<div class="form"> | |
<form name='CadastrarProfissional' method='post' action='updateProfissional.php' onsubmit='return validarCadastro();'> | |
<input type='hidden' name='idProfissional' value='<?php echo $_GET['id']; ?>'> | |
<label>Cadastrar profissional</label> | |
<label>Nome:</label> | |
<input name='nome' type='text' id='nome' value="<?php echo $stmt['nome'] ; ?>" size='47' maxlength='60'> | |
<label>Nascimento:</label> | |
<input name='nascimento' id='nascimento' type='text' placeholder="dia/mes/ano" size='11' value="<?php echo $nascimento; ?>" onChange="IdadeCorreta(this.value);"/> | |
<label>Idade:</label> | |
<input name='idade' id='idade' type='text' size='10' maxlength='3' value="<?php echo $idade ; ?>" onkeypress="return SomenteNumero(event);"/> | |
<label>Sexo:</label> | |
<select name="sexo" id="sexo"> | |
<option <?php if ($stmt['sexo'] == 'M') echo 'selected';?> value="M">Masculino</option> | |
<option <?php if ($stmt['sexo'] == 'F') echo 'selected';?> value="F">Feminino</option> | |
</select> | |
<label>Estado Civil:</label> | |
<select name="estadoCivil" id="estadoCivil"> | |
<option <?php if ($stmt['estadoCivil'] == 'Solteiro') echo 'selected';?> value="solteiro">Solteiro</option> | |
<option <?php if ($stmt['estadoCivil'] == 'Casado') echo 'selected';?> value="casado">Casado</option> | |
<option <?php if ($stmt['estadoCivil'] == 'Divorciado') echo 'selected'; ?> value="divorciado">Divorciado</option> | |
<option <?php if ($stmt['estadoCivil'] == 'Separado') echo 'selected';?> value="separado">Separado</option> | |
<option <?php if ($stmt['estadoCivil'] == 'Viuvo') echo 'selected';?> value="viuvo">Viuvo</option> | |
</select> | |
<label>Vínculo:</label> | |
<select name="vinculo" id="vinculo"> | |
<option <?php if ($stmt['vinculo'] == 'CLT') echo 'selected';?> value="CLT">CLT</option> | |
<option <?php if ($stmt['vinculo'] == 'Temporario') echo 'selected';?> value="Temporario">Temporário</option> | |
</select> | |
<label>Horário de entrada:</label> | |
<input name='horarioEntrada' type='text'size='2' maxlength='5' value="<?php echo $stmt['horarioEntrada'] ; ?>" id='horarioEntrada'> | |
<label>Horário de saída:</label> | |
<input name='horarioSaida' type='text' size='2' maxlength='5' value="<?php echo $stmt['horarioSaida'] ; ?>" id='horarioSaida'> | |
<label>Habilidades:</label> | |
<input type="checkbox" name="habilidade[0]" value="Html" <?php if (in_array('Html' , $habilidade)){ echo "checked" ; } ?>>HTML | |
<input type="checkbox" name="habilidade[1]" value="Css" <?php if (in_array('Css' , $habilidade)) { echo "checked" ; } ?>>CSS | |
<input type="checkbox" name="habilidade[2]" value="Javascript" <?php if (in_array('Javascript' , $habilidade)) { echo "checked" ; } ?>>Javascript | |
<input type="checkbox" name="habilidade[3]" value="Php" <?php if (in_array('Php' , $habilidade)) { echo "checked" ; } ?>>PHP | |
<input type="checkbox" name="habilidade[4]" value="BancoDados" <?php if (in_array('BancoDados' , $habilidade)) { echo "checked" ; } ?>>Banco de dados | |
<label>Observações:</label><textarea rows="3" cols="50" name='observacao' id='observacao' placeholder="O preenchimento deste campo não é obrigatório!" ></textarea> | |
<input type='submit' value='Cadastrar'> | |
</form> | |
<?php } ?> | |
<script> | |
function IdadeCorreta(valor){ | |
document.getElementById('idade').value = parseInt( new Date().getFullYear() ) - parseInt( valor.substr(-4) ); | |
} | |
</script> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.diva{ | |
width: 956px; | |
border: 1px solid gray; | |
margin-left:auto; | |
margin-right:auto; | |
display: table; | |
background-color: #FCFCFC; | |
} | |
.cabecalho{ | |
width:956px; | |
background-color: #FCFCFC; | |
border-bottom: 1px solid gray; | |
padding-left: 58px; | |
padding-right: 80px; | |
float:left; | |
} | |
.menu ul { | |
list-style-type:none; | |
padding: 13px 15px 13px 15px; | |
margin: auto auto auto auto; | |
} | |
.menu{ | |
font-size: 17px; | |
font-family: Thorndale AMT; | |
width:240px; | |
background-color: #FCFCFC; | |
float:left; | |
display:block; | |
} | |
.menu ul li:hover > a { | |
color: #228B22; | |
font-size: 18px; | |
font-family: Palatino Linotype; | |
border: 1px solid #228B22; | |
border-radius: 8px; | |
} | |
.menu ul a, | |
.menu ul a:link, | |
.menu ul a:visited { | |
display: block; | |
color: #4169E1; | |
text-decoration: none; | |
padding: 2px 5px 5px 40px; | |
} | |
.conteudo{ | |
width:852px; | |
border: 0px solid gray; | |
border-left: 1px solid gray; | |
display:block; | |
float:left; | |
background-color: #FCFCFC; | |
} | |
.com-margin { | |
margin:20px; | |
display: block; | |
} | |
label{ | |
font-family: Palatino Linotype; | |
} | |
body { | |
color: #2F4F4F; | |
} | |
input{ | |
font-family: Palatino Linotype; | |
padding-top: 5px; | |
padding-bottom: 4px; | |
padding-left: 3px; | |
padding-right: 15px; | |
border-radius: 7px; | |
border: 1px solid #7A89A1; | |
} | |
input[type="submit"]{ | |
color: #006400; | |
margin-top: 20px; | |
padding-top: 8px; | |
padding-right: 19px; | |
padding-bottom: 8px; | |
padding-left:19px; | |
font-family: Verdana; | |
border: 1px solid #006400; | |
border-radius: 7px; | |
background-color: #FCFCFC; | |
font-size: 15px; | |
} | |
a:hover { | |
color: #34642E; | |
} | |
input[type="submit"]:hover { | |
border: 1px solid; | |
color: #00008B; | |
cursor: pointer; | |
font-family: Verdana; | |
font-size: 15px; | |
} | |
label{ | |
margin: 2px; | |
font-family: Thorndale AMT; | |
display: block; | |
margin-top: 20px; | |
} | |
.Titulo{ | |
font-family: Palatino Linotype; | |
color: Black; | |
margin-left: 94%; | |
margin-right: auto; | |
margin-top: 5%; | |
margin-bottom:5%; | |
} | |
textarea{ | |
display: block; | |
width: 470px; | |
border-radius: 9px; | |
border:1px solid #7A89A1; | |
} | |
.reForm{ | |
display:block; | |
margin: auto auto auto auto; | |
} | |
select{ | |
border-radius:5px; | |
border:1px solid #7A89A1; | |
background-color: #FFFFFF; | |
} | |
.tabela{ | |
display: block; | |
margin: auto auto auto auto; | |
} | |
th, td , tr { | |
font-family: freeSerif; | |
font-size: 16px; | |
border:1px solid black; | |
} | |
th{ | |
color: #1C1C1C; | |
background-color: #BDBDBD; | |
} | |
td{ | |
color: #000011; | |
background-color: #F2F2F2; | |
} | |
.links{ | |
font-family: Verdana; | |
font-size: 15px; | |
margin: 15px auto 5px 25%; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<script language="javascript"> | |
function confirmaDel(){ | |
var r = confirm("Tem certeza que deseja editar esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<?php | |
include "menu.php"; | |
include "database.php"; | |
$tipoTelefone = $_POST["tipoTelefone"]; | |
$operadora = $_POST["operadora"]; | |
$numero = $_POST["numero"]; | |
$tipoEmail = $_POST["tipoEmail"]; | |
$Email = $_POST["Email"]; | |
$idContato = $_POST["idContato"]; | |
# Inserir a codição dessa função: | |
updateContato($tipoTelefone, $operadora, $numero, $tipoEmail, $Email, $idContato); | |
$stmt = buscarContatoPorID($idContato); | |
?> | |
<center> | |
<?php | |
if ($stmt->rowCount() > 0){ ?> | |
<br> | |
<br> | |
<h3> Tabela de registros:</h3> | |
<br> | |
<Table border=1> | |
<tr> | |
<th> Id Contato </th> | |
<th> Tipo de Telefone </th> | |
<th> Operadora </th> | |
<th> Número </th> | |
<th> Tipo de email</th> | |
<th> Email </th> | |
<th> Excluir </th> | |
<th> Editar </th> | |
<th> Voltar </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
?> | |
<tr> | |
<td><?php echo $result['idContato'];?></td> | |
<td><?php echo $result['tipoTelefone'];?></td> | |
<td><?php echo $result['operadora'];?></td> | |
<td><?php echo $result['numero'];?></td> | |
<td><?php echo $result['tipoEmail']; ?></td> | |
<td><?php echo $result['Email'];?></td> | |
<td><a href=delContato.php?id=<?php echo $result['idContato'];?> onClick="return confirmaDel();">Excluir </a></td> | |
<td><a href=editarContato.php?id=<?php echo $result['idContato'];?>>Editar </a></td> | |
<td><a href=registros.php?id=<?php echo $result['idProfissional'];?> onClick="return confirma();">Voltar </a></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
<br><br> | |
<center> Nenhum registro encontrado! </center> | |
<?php } ?> | |
<br> | |
</center> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<script language="javascript"> | |
function confirmaDel(){ | |
var r = confirm("Tem certeza que deseja editar esse registro?"); | |
if (r == true){ | |
}else{ | |
return false; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<?php | |
include "menu.php"; | |
include "database.php"; | |
$cidade = $_POST["cidade"]; | |
$logradouro = $_POST["logradouro"]; | |
$bairro = $_POST["bairro"]; | |
$numero = $_POST["numero"]; | |
$tipoEndereco = $_POST["tipoEndereco"]; | |
$complemento = $_POST["complemento"]; | |
$cep = $_POST["cep"]; | |
$uf = $_POST["uf"]; | |
$idEndereco = $_POST["idEndereco"]; | |
# Inserir a codição dessa função: | |
atualizar($cidade, $logradouro, $bairro, $numero, $tipoEndereco, $complemento , $cep, $uf, $idEndereco); | |
$stmt = buscarEnderecoPorID($idEndereco); | |
?> | |
<center> | |
<?php | |
if ($stmt->rowCount() > 0){ ?> | |
<br> | |
<br> | |
<h3> Tabela de registros:</h3> | |
<br> | |
<Table border=1> | |
<tr> | |
<th> Id Endereco </th> | |
<th> Cidade </th> | |
<th> Logradouro </th> | |
<th> Bairro </th> | |
<th> Número </th> | |
<th> Tipo de Endereco </th> | |
<th> Complemento </th> | |
<th> Cep </th> | |
<th> UF </th> | |
<th> Excluir </th> | |
<th> Editar </th> | |
<th> Voltar </th> | |
</tr> | |
<?php | |
while($result = $stmt->fetch()){ | |
?> | |
<tr> | |
<td><?php echo $result['idEndereco'];?></td> | |
<td><?php echo $result['cidade'];?></td> | |
<td><?php echo $result['logradouro'];?></td> | |
<td><?php echo $result['bairro'];?></td> | |
<td><?php echo $result['numero']; ?></td> | |
<td><?php echo $result['tipoEndereco'];?></td> | |
<td><?php echo $result['complemento']; ?></td> | |
<td><?php echo $result['cep']; ?></td> | |
<td><?php echo $result['uf'];?></td> | |
<td><a href=delEnd.php?id=<?php echo $result['idEndereco'];?> onClick="return confirmaDel();">Excluir </a></td> | |
<td><a href=editarEnd.php?id=<?php echo $result['idEndereco'];?>>Editar </a></td> | |
<td><a href=registros.php?id=<?php echo $result['idProfissional'];?> onClick="return confirma();">Voltar </a></td> | |
</tr> | |
<?php } ?> | |
</Table> | |
<?php }else{ ?> | |
<br><br> | |
<center> Nenhum registro encontrado! </center> | |
<?php } ?> | |
<br> | |
</center> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf8'> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
</head> | |
<body> | |
<div class="diva"> | |
<div class="cabecalho"> | |
<center><img src="img/crud3.png"/></center> | |
</div> | |
<div class="menu"> | |
<?php include "menu.php"; ?> | |
</div> | |
<div class="conteudo"> | |
<div class="com-margin"> | |
<?php | |
include "database.php"; | |
$nome = $_POST["nome"]; | |
$idade = $_POST["idade"]; | |
$nascimento = $_POST["nascimento"]; | |
$sexo = $_POST["sexo"]; | |
$estadoCivil = $_POST["estadoCivil"]; | |
$habilidade = $_POST["habilidade"]; | |
$vinculo = $_POST["vinculo"]; | |
$horarioEntrada = $_POST["horarioEntrada"]; | |
$horarioSaida = $_POST["horarioSaida"]; | |
$observacao = $_POST["observacao"]; | |
$idProfissional = $_POST["idProfissional"]; | |
$habilidade = implode(",", $habilidade); #Declaração de variavel, uso do implode e a separação do array feita por vígula. | |
$nascimento = implode("/", array_reverse(explode("/", $nascimento))); #Declaração de variavel, uso do implode e a separação do array feita por barra. | |
updateProfissional($nome, $idade, $nascimento, $sexo, $estadoCivil, $habilidade, $vinculo, $horarioEntrada , $horarioSaida, $observacao, $idProfissional); | |
# Abaixo está a função utilizada para textar erros nos parametros declarado a cima. | |
# updateProfissional('nome', 'idade', 'nascimento', 'sexo', 'estadoCivil', 'habilidade', 'vinculo', 'horarioEntrada' , 'horarioSaida', 'observacao', 'idProfissional'); | |
?> | |
<center><h3> Tabela de registros:</h3></center> | |
<Table border=1 style="border-collapse: collapse"> | |
<tr> | |
<th> Id </th> | |
<th> Nome </th> | |
<th> Idade </th> | |
<th> Nascimento </th> | |
<th> Sexo </th> | |
<th> Estado Civil </th> | |
<th> Habilidades </th> | |
<th> Vínculo </th> | |
<th> Horario de Entrada </th> | |
<th> Horário de Saida </th> | |
<th> Observações </th> | |
<th> Endereço </th> | |
<th> Contato </th> | |
</tr> | |
<?php | |
$habilidade = implode('</br>',array_reverse(explode(',',$habilidade))); | |
$observacao = implode('</p>',array_reverse(explode(',',$observacao))); | |
?> | |
<tr> | |
<td><?php echo $idProfissional; ?></td> | |
<td><?php echo $nome?></td> | |
<td><?php echo $idade;?></td> | |
<td><?php echo $nascimento = implode("/", array_reverse(explode("/", $nascimento)));?></td> | |
<td><?php echo $sexo; ?></td> | |
<td><?php echo $estadoCivil; ?></td> | |
<td><?php echo $habilidade; ?></td> | |
<td><?php echo $vinculo;?></td> | |
<td><?php echo $horarioEntrada; ?></td> | |
<td><?php echo $horarioSaida; ?></td> | |
<td><?php echo $observacao; ?></td> | |
<td><a href=endereco.php?id=<?php echo $idProfissional;?> onClick="return confirma();">Cadastrar Endereço </a></td> | |
<td><a href=contato.php?id=<?php echo $idProfissional;?> onClick="return confirma();">Cadastrar Contato </a></td> | |
</tr> | |
</Table> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment