Advertisement
LightProgrammer000

Voto [HMTL + PHP]

Nov 23rd, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.59 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2.  
  3. <html lang="pt-br">
  4.  
  5.     <!-- Cabeçalho -->
  6.     <head>
  7.         <meta charset="utf-8">
  8.         <title> Aula 07 </title>
  9.  
  10.         <!-- Seção CSS -->
  11.         <link rel="stylesheet" href="../_css/estilo.css"> </style>
  12.         <style>
  13.             html
  14.             {
  15.                 font-size: 18px;
  16.                 font-style: normal;
  17.                 font-weight: normal;
  18.  
  19.                 color: darkblue;
  20.                 text-shadow: 2px 2px 4px #000000;
  21.             }
  22.  
  23.             fieldset
  24.             {
  25.                 width: 70% ;
  26.             }
  27.  
  28.             .button
  29.             {
  30.                 margin: 3px;
  31.                 display: inline-block;
  32.  
  33.                 border: none;
  34.                 border-radius: 4px;
  35.  
  36.                 color: #FFFFFF;
  37.                 background-color: darkblue;
  38.  
  39.                 width: 100px;
  40.                 padding: 15px;
  41.  
  42.                 text-align: center;
  43.                 font-size: 15px;
  44.  
  45.                 cursor: pointer;
  46.                 transition: all 0.5s;
  47.             }
  48.  
  49.             .button span
  50.             {
  51.                 cursor: pointer;
  52.                 display: inline-block;
  53.                 position: relative;
  54.                 transition: 0.5s;
  55.             }
  56.  
  57.             .button:hover span
  58.             {
  59.                 padding-right: 25px;
  60.             }
  61.  
  62.             .button span:after
  63.             {
  64.                 top: 0;
  65.                 right: -20px;
  66.                 position: absolute;
  67.  
  68.                 content: '\00bb';
  69.                 opacity: 0;
  70.                 transition: 0.5s;
  71.             }
  72.  
  73.             .button:hover span:after
  74.             {
  75.                 right: 0;
  76.                 opacity: 1;
  77.             }
  78.         </style>
  79.     </head>
  80.  
  81. <!-- Corpo -->
  82. <body>
  83.  
  84.     <!-- Bloco -->
  85.     <div>
  86.         <form method="get" action="Voto.php">
  87.             <fieldset>
  88.                 <legend> Formulário </legend> <br>
  89.  
  90.                 <label for="ano_nasc"> Ano de Nascimento: </label>
  91.                 <input type="number" id="ano_nasc" name="ano" placeholder="4 dígitos"> <br> <br>
  92.  
  93.                 <!-- Botão -->
  94.                 <button class="button" type="submit" value="Enviar" style="vertical-align:middle"> <span> Enviar </span> </button>
  95.                 <button class="button" type="reset" value="Limpar" style="vertical-align:middle"> <span> Limpar </span> </button>
  96.             </fieldset>
  97.         </form>
  98.     </div>
  99.  
  100. </body>
  101.  
  102. </html>
  103.  
  104. <!----------------------------------------- -->
  105. <!----------------------------------------- -->
  106. <!----------------------------------------- -->
  107. <!----------------------------------------- -->
  108. <!----------------------------------------- -->
  109.  
  110. <!DOCTYPE HTML>
  111.  
  112. <html lang="pt-br">
  113.  
  114.     <!-- Cabeçalho -->
  115.     <head>
  116.         <meta charset="utf-8">
  117.         <title> Aula 07 </title>
  118.  
  119.         <!-- Seção CSS -->
  120.         <link rel="stylesheet" href="../_css/estilo.css"> </style>
  121.         <style>
  122.             html
  123.             {
  124.                 font-size: 18px;
  125.                 font-style: normal;
  126.                 font-weight: normal;
  127.  
  128.                 color: darkblue;
  129.                 text-shadow: 2px 2px 4px #000000;
  130.             }
  131.  
  132.             button
  133.             {
  134.                 cursor: pointer;
  135.  
  136.                 color: blue;
  137.                 background-color: #4CAF50; /* Green */
  138.  
  139.                 border: none;
  140.                 display: inline-block;
  141.  
  142.                 margin: 40px 190px;
  143.                 padding: 16px 32px;
  144.  
  145.                 font-size: 16px;
  146.                 text-align: center;
  147.                 text-decoration: none;
  148.  
  149.                 transition-duration: 0.4s;
  150.                 -webkit-transition-duration: 0.4s; /* Safari */
  151.             }
  152.  
  153.             .button1
  154.             {
  155.                 border: 2px solid #4CAF50;
  156.  
  157.                 color: black;
  158.                 background-color: white;
  159.             }
  160.  
  161.             .button1:hover
  162.             {
  163.                 color: white;
  164.                 background-color: #4CAF50;
  165.             }
  166.         </style>
  167.     </head>
  168.  
  169. <!-- Corpo -->
  170. <body>
  171.  
  172. <div>  
  173.  
  174. <?php
  175.  
  176. # Supressão de erros
  177. error_reporting(0);
  178.  
  179. // Captura de variáveis
  180. $ano_nasc = isset($_GET['ano']) ? ($_GET['ano']) : (0) ;
  181. $idade = date('Y') - $ano_nasc;
  182.  
  183. // Saída de dados
  184. echo "Ano de Nascimento: " . $ano_nasc . "<br>";
  185. echo "Idade: " . $idade . " anos";
  186.  
  187. // Estrutura Condicional
  188. if($idade > 18)
  189. {
  190.     $resp = "SIM";
  191. }
  192.  
  193. else
  194. {
  195.     $resp = "NÃO";
  196. }
  197.  
  198. echo "<br> Poderá votar ? >>> $resp";
  199. echo "<br> Poderá dirigir ? >>> $resp";
  200.  
  201. ?>
  202.  
  203. <br> <br>
  204. <button class="button1" value="Voltar" onClick="history.go(-1)"> Voltar </button>
  205.  
  206. </div>
  207.    
  208. </body>
  209.  
  210. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement