-
Notifications
You must be signed in to change notification settings - Fork 1
/
cadastrar.php
52 lines (34 loc) · 1.13 KB
/
cadastrar.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
<?php
require "conexao.php";
$nome = $_POST['nome'];
$cpf = $_POST['cpf'];
$endereco = $_POST['endereco'];
$bairro = $_POST['bairro'];
$cidade = $_POST['cidade'];
$uf = $_POST['uf'];
$tel = $_POST['tel'];
$dtnasc = $_POST['dtnasc'];
$dtcons = $_POST['dtcons'];
$horario = $_POST['horario'];
$dataAtual = date('Y-m-d H:i');
$primeira = $_POST['primeira'];
$tipoconsulta = $_POST['tipoconsulta'];
if($tipoconsulta =='Particular'){
$plano = 'Particular';
}else{
$plano = $_POST['plano'];
}
$status = $_POST['status'];
$sessoes = $_POST['sessoes'];
$precoCons = $_POST['precoCons'];
$total = $_POST['total'];
try{
$sql = "INSERT into agendamento(nome,cpf,endereco,bairro,cidade,uf,telefone,dtnasc,dtcons,horario,atendido,dataAtual,primeira,tipoConsulta,plano,status,sessoes,total,precoCons) values";
$sql .= "('$nome', '$cpf', '$endereco','$bairro','$cidade','$uf','$tel','$dtnasc','$dtcons','$horario','N','$dataAtual','$primeira','$tipoconsulta','$plano','$status','$sessoes','$total','$precoCons')";
$result = mysql_query($sql) or die(mysql_error());
echo "1"; //inserido com sucesso
}
catch(Exception $ex){
echo "0"; //erro ao inserir
}
?>