Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $user = "cnsmaxim_teste1";
  4. $pass = "";
  5. $banco = "cnsmaxim_teste";
  6.  
  7. $conexao = mysql_connect($host, $user, $pass) or die (mysql_error());
  8. mysql_select_db($banco);
  9. ?>
  10.  
  11. <?php
  12. include "conecta_mysql.inc";
  13.  
  14. $tAut =$_POST ["tAut"];
  15. $tPrest =$_POST ["tPrest"];
  16. $tCart =$_POST ["tCart"];
  17. $cDadm =$_POST ["cDadm"];
  18. $tNome =$_POST ["tNome"];
  19. $tNasc =$_POST ["tNasc"];
  20. $tCnpj =$_POST ["tCnpj"];
  21. $tNomecont =$_POST ["tNomecont"];
  22. $tCodcnes =$_POST ["tCodcnes"];
  23. $tProf =$_POST ["tProf"];
  24. $tEsp =$_POST ["tEsp"];
  25. $tConsr =$_POST ["tConsr"];
  26. $tNcons =$_POST ["tNcons"];
  27. $tCbos =$_POST ["tCbos"];
  28. $tDatatm =$_POST ["tDatatm"];
  29. $tTab =$_POST ["tTab"];
  30. $tCodp =$_POST ["tCodp"];
  31.  
  32.  
  33. $sql = "INSERT INTO tabteste VALUES ";
  34. $sql .= "('$tAut', '$tPrest', '$tCart', '$cDadm', '$tNome', '$tNasc', '$tCnpj', '$tNomecont', '$tCodcnes', '$tProf', '$tEsp', '$tConsr', '$tNcons', '$tCbos', '$tDatatm', '$tTab', '$tCodp')";
  35. $resultado = mysql_query ($sql);
  36. echo "Dados salvos com sucesso!";
  37. mysql_close ($conexao);
  38. ?>
  39.  
  40. <html>
  41. <head>
  42. <meta name="description" content="Guia de Consulta CNS"/>
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  44. <link rel="stylesheet" href="_css/style.css" />
  45. </head>
  46. <body>
  47.  
  48.  
  49. <?php
  50.  
  51. $tAut =$_POST ["tAut"];
  52. $tPrest =$_POST ["tPrest"];
  53. $tCart =$_POST ["tCart"];
  54. $cDadm =$_POST ["cDadm"];
  55. $tNome =$_POST ["tNome"];
  56. $tNasc =$_POST ["tNasc"];
  57. $tCnpj =$_POST ["tCnpj"];
  58. $tNomecont =$_POST ["tNomecont"];
  59. $tCodcnes =$_POST ["tCodcnes"];
  60. $tProf =$_POST ["tProf"];
  61. $tEsp =$_POST ["tEsp"];
  62. $tConsr =$_POST ["tConsr"];
  63. $tNcons =$_POST ["tNcons"];
  64. $tCbos =$_POST ["tCbos"];
  65. $tDatatm =$_POST ["tDatatm"];
  66. $tTab =$_POST ["tTab"];
  67. $tCodp =$_POST ["tCodp"];
  68.  
  69. //Verifica se o campo não está em branco.
  70. if (empty($tAut))
  71. {
  72. $error[] = 'Preenchimento da Autorização obrigatório!<br>';
  73. }
  74. //Verifica se o campo não está embranco.
  75.  
  76. if (empty($tPrest))
  77. {
  78. $error[] = 'Preenchimento do Número da Guia do Prestador obrigatório!<br>';
  79. }
  80. //Verifica se o campo não está em branco.
  81.  
  82. if (empty($tCart))
  83. {
  84. $error[] = 'Preenchimento do Número da Carteirinha obrigatório!<br>';
  85.  
  86. }
  87. //Verifica se o campo não está em branco.
  88. if (empty($cDadm)) {
  89. $error[] = 'Preenchimento da Data de Admissão obrigatório!<br>';
  90.  
  91. }
  92. //Verifica se o campo não está em branco.
  93. if (empty($tNome)) {
  94. $error[] = 'Preenchimento do Nome obrigatório!<br>';
  95.  
  96. }
  97. //Verifica se o campo não está em branco.
  98. if (empty($tNasc)) {
  99. $error[] = 'Preenchimento da Data de Nascimento obrigatório!<br>';
  100.  
  101. }
  102. //Verifica se o campo não está em branco.
  103. if (empty($tCnpj)) {
  104. $error[] = 'Preenchimento do CNPJ obrigatório!<br>';
  105.  
  106. }
  107. //Verifica se o campo não está em branco.
  108. if (empty($tNomecont)) {
  109. $error[] = 'Preenchimento do Nome do Contratado obrigatório!<br>';
  110.  
  111. }
  112. //Verifica se o campo não está em branco.
  113. if (empty($tCodcnes)) {
  114. $error[] = 'Preenchimento do Código CNES obrigatório!<br>';
  115.  
  116. }
  117. //Verifica se o campo não está em branco.
  118. if (empty($tProf)) {
  119. $error[] = 'Preenchimento do Profissional Executante obrigatório!<br>';
  120.  
  121. }
  122. //Verifica se o campo não está em branco.
  123. if (empty($tEsp)) {
  124. $error[] = 'Preenchimento da Especialidade obrigatório!<br>';
  125.  
  126. }
  127. //Verifica se o campo não está em branco.
  128. if (empty($tConsr)) {
  129. $error[] = 'Preenchimento do Conselho Regional obrigatório!<br>';
  130.  
  131. }
  132. //Verifica se o campo não está em branco.
  133. if (empty($tNcons)) {
  134. $error[] = 'Preenchimento do Número do Conselho obrigatório!<br>';
  135.  
  136. }
  137. //Verifica se o campo não está em branco.
  138. if (empty($tCbos)) {
  139. $error[] = 'Preenchimento do Número do CBOS obrigatório!<br>';
  140.  
  141. }
  142. //Verifica se o campo não está em branco.
  143. if (empty($tDatatm)) {
  144. $error[] = 'Preenchimento da Data de Atendimento obrigatório!<br>';
  145.  
  146. }
  147. //Verifica se o campo não está em branco.
  148. if (empty($tTab)) {
  149. $error[] = 'Preenchimento da Tabela obrigatório!<br>';
  150.  
  151. }
  152. //Verifica se o campo não está em branco.
  153. if (empty($tCodp)) {
  154. $error[] = 'Preenchimento do Código do Procedimento obrigatório!<br>';
  155.  
  156. }
  157.  
  158. if (isset($error)){ // se houve erro
  159. foreach($error as $msg) {
  160. echo $msg;
  161. }
  162. } else { // não houve erro
  163. $error[] = 'Todos os campos preenchidos corretamente!';
  164. include "insere.php";
  165. }
  166. ?>
  167. </body>
  168. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement