Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "cnsmaxim_teste1";
- $pass = "";
- $banco = "cnsmaxim_teste";
- $conexao = mysql_connect($host, $user, $pass) or die (mysql_error());
- mysql_select_db($banco);
- ?>
- <?php
- include "conecta_mysql.inc";
- $tAut =$_POST ["tAut"];
- $tPrest =$_POST ["tPrest"];
- $tCart =$_POST ["tCart"];
- $cDadm =$_POST ["cDadm"];
- $tNome =$_POST ["tNome"];
- $tNasc =$_POST ["tNasc"];
- $tCnpj =$_POST ["tCnpj"];
- $tNomecont =$_POST ["tNomecont"];
- $tCodcnes =$_POST ["tCodcnes"];
- $tProf =$_POST ["tProf"];
- $tEsp =$_POST ["tEsp"];
- $tConsr =$_POST ["tConsr"];
- $tNcons =$_POST ["tNcons"];
- $tCbos =$_POST ["tCbos"];
- $tDatatm =$_POST ["tDatatm"];
- $tTab =$_POST ["tTab"];
- $tCodp =$_POST ["tCodp"];
- $sql = "INSERT INTO tabteste VALUES ";
- $sql .= "('$tAut', '$tPrest', '$tCart', '$cDadm', '$tNome', '$tNasc', '$tCnpj', '$tNomecont', '$tCodcnes', '$tProf', '$tEsp', '$tConsr', '$tNcons', '$tCbos', '$tDatatm', '$tTab', '$tCodp')";
- $resultado = mysql_query ($sql);
- echo "Dados salvos com sucesso!";
- mysql_close ($conexao);
- ?>
- <html>
- <head>
- <meta name="description" content="Guia de Consulta CNS"/>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" href="_css/style.css" />
- </head>
- <body>
- <?php
- $tAut =$_POST ["tAut"];
- $tPrest =$_POST ["tPrest"];
- $tCart =$_POST ["tCart"];
- $cDadm =$_POST ["cDadm"];
- $tNome =$_POST ["tNome"];
- $tNasc =$_POST ["tNasc"];
- $tCnpj =$_POST ["tCnpj"];
- $tNomecont =$_POST ["tNomecont"];
- $tCodcnes =$_POST ["tCodcnes"];
- $tProf =$_POST ["tProf"];
- $tEsp =$_POST ["tEsp"];
- $tConsr =$_POST ["tConsr"];
- $tNcons =$_POST ["tNcons"];
- $tCbos =$_POST ["tCbos"];
- $tDatatm =$_POST ["tDatatm"];
- $tTab =$_POST ["tTab"];
- $tCodp =$_POST ["tCodp"];
- //Verifica se o campo não está em branco.
- if (empty($tAut))
- {
- $error[] = 'Preenchimento da Autorização obrigatório!<br>';
- }
- //Verifica se o campo não está embranco.
- if (empty($tPrest))
- {
- $error[] = 'Preenchimento do Número da Guia do Prestador obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tCart))
- {
- $error[] = 'Preenchimento do Número da Carteirinha obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($cDadm)) {
- $error[] = 'Preenchimento da Data de Admissão obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tNome)) {
- $error[] = 'Preenchimento do Nome obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tNasc)) {
- $error[] = 'Preenchimento da Data de Nascimento obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tCnpj)) {
- $error[] = 'Preenchimento do CNPJ obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tNomecont)) {
- $error[] = 'Preenchimento do Nome do Contratado obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tCodcnes)) {
- $error[] = 'Preenchimento do Código CNES obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tProf)) {
- $error[] = 'Preenchimento do Profissional Executante obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tEsp)) {
- $error[] = 'Preenchimento da Especialidade obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tConsr)) {
- $error[] = 'Preenchimento do Conselho Regional obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tNcons)) {
- $error[] = 'Preenchimento do Número do Conselho obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tCbos)) {
- $error[] = 'Preenchimento do Número do CBOS obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tDatatm)) {
- $error[] = 'Preenchimento da Data de Atendimento obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tTab)) {
- $error[] = 'Preenchimento da Tabela obrigatório!<br>';
- }
- //Verifica se o campo não está em branco.
- if (empty($tCodp)) {
- $error[] = 'Preenchimento do Código do Procedimento obrigatório!<br>';
- }
- if (isset($error)){ // se houve erro
- foreach($error as $msg) {
- echo $msg;
- }
- } else { // não houve erro
- $error[] = 'Todos os campos preenchidos corretamente!';
- include "insere.php";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement