Pesquisar na Comunidade
Mostrando resultados para as tags ''calculadora simples''.
Encontrado 1 registro
-
PHP + HTML + CSS HTML, CSS Pagina index.php <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Calculadora RFWC</title> <link rel="stylesheet" type="text/css" href="css/css.css"/> </head> <body> <div id="corpo"> <header> <img src="img/header.png"/> </header> <section> <form id="calculadora" action="resposta.php" method="POST"> <select name="slt_Op"> <option value="0">Selecione...</option> <option value="1">+</option> <option value="2">-</option> <option value="3">*</option> <option value="4">/</option> </select><br><br> <input type="text" name="txt_Num1" required placeholder="Ex: 10"/><br><br> <input type="text" name="txt_Num2" required placeholder="Ex: 20"/><br><br> <input type="submit" name="btn_Calcular" value="Calcular" /> </form> </section> <footer> <p>Todos os direitos reservados © </p> </footer> </div> </body> </html> Pagina resposta.php <!DOCTYPE HTML> <?php $op = $_POST['slt_Op']; $num1 = $_POST['txt_Num1']; $num2 = $_POST['txt_Num2']; $total = 0; if($op == 0){ echo("<script type='text/javascript'> alert('Escolha a opção corretamente!' ); location.href='../index.php';</script>"); } else{ if($num1 == "" || $num2 == ""){ echo("<script type='text/javascript'> alert('Preencha todos os campos!' ); location.href='../index.php';</script>"); } else{ switch($op){ case 1: $total = $num1 + $num2; break; case 2: $total = $num1 - $num2; break; case 3: $total = $num1 * $num2; break; case 4: $total = $num1 / $num2; break; default: echo("<script type='text/javascript'> alert('Houve um erro, tente novamente!' ); location.href='../index.php';</script>"); } } } ?> <html> <head> <meta charset="utf-8"> <title>Calculadora RFWC</title> <link rel="stylesheet" type="text/css" href="css/css2.css"/> </head> <body> <div id="corpo"> <header> <img src="img/header.png"/> </header> <section> <form id="resposta" action="index.php"> <label> Total </label><br><br> <div id="resposta"><?php echo $total; ?></div> <input type="submit" name="btn_Voltar" value="Voltar"/> </form> </section> <footer> <p>Todos os direitos reservados © </p> </footer> </div> </body> </html> CSS css.css #corpo{ width: 800px; height: 600px; margin: 0 auto; } header{ width:100%; height: 100px; background-image: url("img/header.png"); } section{ width:100%; height: 450px; border:1px solid #47474c; } footer{ width:100%; height: 50px; background-color:#47474c; border:1px solid #47474c; color:#14ca9c; font-family: Arial; text-align:center; } select{ width: 303px; height:35px; text-align: center; } form{ width: 300px; height: 300px; margin:auto; margin-top:70px; } input[type="text"]{ width: 300px; height:25px; } input[type="submit"]{ width: 305px; height:25px; border:none; color:white; background-color:#47474c; cursor:pointer; font-size:18px; font-family: Arial; } input[type="submit"]:hover{ background-color: #14ca9c; } css2.css #corpo{ width: 800px; height: 600px; margin: 0 auto; } header{ width:100%; height: 100px; background-image: url("img/header.png"); } section{ width:100%; height: 450px; border:1px solid #47474c; } footer{ width:100%; height: 50px; background-color:#47474c; border:1px solid #47474c; color:#14ca9c; font-family: Arial; text-align:center; } select{ width: 303px; height:35px; text-align: center; } form{ width: 300px; height: 300px; margin:auto; margin-top:70px; text-align:center; } input[type="submit"]{ width: 305px; height:25px; border:none; color:white; background-color:#47474c; cursor:pointer; font-size:18px; font-family: Arial; margin-top:235px; } input[type="submit"]:hover{ background-color: #14ca9c; } label{ width: 100%; font-family: Arial; font-size: 18px; } Qualquer duvida ou dica, por favor comente
