Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html> <html lang="pl">
- <head>
- <meta charset="utf-8"> <title>Formularze</title>
- <meta http-equiv="X-Ua-Compatible" content="IE=edge,chrome=1">
- </head>
- <body>
- <br>
- <br>
- <form method="post">
- <label>A: <input type="text" name="aa" /></label>
- <label>B: <input type="text" name="bb" /></label> <br>
- <input type="radio" name="ans" value="+"/> + <br>
- <input type="radio" name="ans" value="-"/> - <br>
- <input type="radio" name="ans" value="*"/> * <br>
- <input type="radio" name="ans" value=":"/> : <br>
- <input type="submit" value="Oblicz" />
- <input type="reset" value="Wyczyść" />
- </form>
- <?php
- $a = $_POST['aa'];
- $b = $_POST['bb'];
- $answer = $_POST['ans'];
- if ($answer == "+"){
- $wynik = $a + $b;
- echo $wynik;
- }
- if ($answer == "-"){
- $wynik = $a - $b;
- echo $wynik;
- }
- if ($answer == "*"){
- $wynik = $a * $b;
- echo $wynik;
- }
- if ($answer == ":"){
- $wynik = $a / $b;
- echo $wynik;
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement