Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['igual'])) {
- $NU = (int) $_POST['NU'];
- $ND = (int) $_POST['ND'];
- $SA = $_POST['SA'];
- if ($SA == "+") {
- $RS = $NU+$ND;
- }
- if ($SA == "-") {
- $RS = $NU-$ND;
- }
- if ($SA == "/") {
- $RS = $NU/$ND;
- }
- if ($SA == "*") {
- $RS = $NU*$ND;
- }
- }
- error_reporting(0);
- ?>
- <!-- Author: Yaiko; Date: 19/02/15 -->
- <!DOCTYPE html>
- <html lang="CO">
- <head>
- <title>Calculadora</title>
- <meta charset="utf-8">
- </head>
- <body>
- <center>
- <h1>Mini - Calculadora</h1>
- <form method="POST">
- <fieldset style="width:200px;">
- <input type="text" name="NU" style="width:50px;" placeholder="#1">
- <select name="SA">
- <option value="+">+</option>
- <option value="-">-</option>
- <option value="/">/</option>
- <option value="*">*</option>
- </select>
- <input type="text" name="ND" style="width:50px;" placeholder="#2">
- <input type="submit" name="igual" value="=">
- <?php echo $RS; ?>
- </fieldset>
- </form>
- <h6>Learn the basics of the advanced</h6>
- <h5>By <b><a href="http://twitter.com/El_Yaiko" target="_blank">Yaiko</a></b></h5>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement