Advertisement
rootUser

(SD Offline multiply two numbers upto a limit

Dec 8th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.94 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <title>Bootstrap Example</title>
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1">
  7.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  8.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  9.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  10.   </head>
  11.   <body style="text-align:center">
  12.     <div class="container">
  13.       <h2>SD LAB IV - ASSIGNMENT : 1</h2>
  14.       <form method="post" enctype="multipart/form-data">
  15.         <div class="form-group">
  16.           <label for="multiplicand">ENTER MULTIPLICAND :</label>
  17.           <input style="text-align:center" type="number" class="form-control" id="multiplicand" placeholder="ENTER MULTIPLICAND" name="multiplicandField" required>
  18.         </div>
  19.         <div class="form-group">
  20.           <label for="multiplierL">ENTER LOWEST VALUE OF MULTIPLIER :</label>
  21.           <input style="text-align:center" type="number" class="form-control" id="multiplierL" placeholder="ENTER LOWEST MULTIPLIER" name="multiplierFieldL" required>
  22.         </div>
  23.         <div class="form-group">
  24.           <label for="multiplierH">ENTER HIGHEST VALUE OF MULTIPLIER :</label>
  25.           <input style="text-align:center" type="number" class="form-control" id="multiplierH" placeholder="ENTER HIGHEST MULTIPLIER" name="multiplierFieldH" required>
  26.         </div>
  27.         <button type="submit" class="btn btn-primary" name="submitButton">SUBMIT</button>
  28.         <button type="reset" class="btn btn-danger" name="resetButton">RESET</button>
  29.       </form>
  30.     </div>
  31.     <?php
  32.      if (isset($_POST["submitButton"]))
  33.      {
  34.           $getMultiplicand = $_POST["multiplicandField"];
  35.           $getMultiplierL   = $_POST["multiplierFieldL"];
  36.           $getMultiplierH = $_POST["multiplierFieldH"];
  37.           echo "<div class=\"container\" style=\"text-align:center\">";
  38.           echo "<br>" . "<h3>" . "RESULT TABLE" . "</h3>" . "<br>";
  39.           echo "<table class=\"table table-striped table-bordered table-condensed table-responsive table-hover\">";
  40.           echo "<thead>";
  41.           echo "<tr>";
  42.           echo "<th style=\"text-align:center\">MULTIPLICAND</th>";
  43.           echo "<th style=\"text-align:center\">MULTIPLIER</th>";
  44.           echo "<th style=\"text-align:center\">RESULT</th>";
  45.           echo "</tr>";
  46.           echo "</thead>";
  47.           echo "<tbody>";
  48.           for ($i = $getMultiplierL ; $i <= $getMultiplierH ; $i++)
  49.           {
  50.              $result = $getMultiplicand * $i;
  51.              echo "<tr>";
  52.               echo "<td>" . $getMultiplicand . "</td>";
  53.               echo "<td>" . $i . "</td>";
  54.               echo "<td>" . $result . "</td>";
  55.               echo "</tr>";
  56.           }
  57.           echo "</tbody>";
  58.           echo "</table>";
  59.           echo "</div>";
  60.       }
  61.       ?>  
  62.   </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement