essa - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of essa.php
- <html>
- <head>
- <body>
- <form method="POST" action="">
- <input type="text" name="liczba1" size="10">
- <select name="znak">
- <option>+</option>
- <option>-</option>
- <option>*</option>
- <option>/</option>
- </select>
- <input type="text" name="liczba2" size="10">
- <input type="submit" value="Oblicz">
- </form>
- <?php
- $liczba1 = $_POST['liczba1'];
- $liczba2 = $_POST['liczba2'];
- $znak = $_POST['znak'];
- $wynik = "";
- switch ($znak)
- {
- case "+":
- $wynik = $liczba1+$liczba2;
- break;
- case "-":
- $wynik = $liczba1-$liczba2;
- break;
- case "*":
- $wynik = $liczba1*$liczba2;
- break;
- case "/":
- $wynik = $liczba1/$liczba2;
- break;
- }
- echo $wynik;
- ?>
- </body>
- </head>
- </html>