Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- // Turn off all error reporting
- error_reporting(0);
- ?>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Calculator</title>
- <style>
- label {
- display: inline-block;
- width:130px;
- }
- </style>
- </head>
- <body>
- <p>Калкулатор за изчисление на доза за приспиване след тежък ден</p>
- <form method="get" action="index.php">
- <p><label for="bug">Брой бъгове</label><input type="text" name="number1" id="bug"></p>
- <p><label for="hour">Отделено време</label><input type="text" name="number2" id="hour"></p>
- <p><label for="opt">Лекарство</label>
- <select name="number3" id="opt">
- <option value="2">Бира</option>
- <option value="1">Ракия</option>
- </select>
- </p>
- <input type="submit" value="relax">
- </form>
- <br/>
- </body>
- </html>
- <?php
- $num1 = $_GET['number1'];
- $num2 = $_GET['number2'];
- $num3 = $_GET['number3'];
- if ($num1 == 0 && $num2 == 0 ) {
- echo '<div>'.'Не се нуждаете от лекарство'.'</div>';
- } else if ($num1 > 0 && $num2 > 0){
- if ($num3 == 1) {
- echo '<div>'.'Нуждаете се от '.$num1+$num2.' '.$num3.'</div>';
- }
- if ($num3 == 2) {
- echo '<div>'.'Нуждаете се от '.$num1*$num2.' '.$num3.'</div>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement