Advertisement
mcnc

tablica mnozenja

Nov 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <!--
  4. To change this license header, choose License Headers in Project Properties.
  5. To change this template file, choose Tools | Templates
  6. and open the template in the editor.
  7. -->
  8. <html>
  9. <head>
  10. <meta charset="UTF-8">
  11. <title>Tablica mnozenja</title>
  12. </head>
  13. <style>
  14. table, th, tr {
  15. border: 1px solid black;
  16. border-collapse: collapse;
  17. }
  18. th, td {
  19. padding: 5px;
  20. text-align: center;
  21. }
  22. </style>
  23. <body>
  24.  
  25. <form action="index.php" method="post">
  26. <p>Unesite opseg tablice mnozenja</p>
  27. <p>Broj: <input type="number" name="broj" /></p>
  28. <p><input type="submit" name="submit" value="Upisi" /></p>
  29. <?php
  30. if(!empty($_POST["broj"])) {
  31.  
  32. $broj = $_POST["broj"];
  33. echo '<table border="1">';
  34. for($a = 1; $a <= $broj; $a++) {
  35. $rez = $a * $broj;
  36.  
  37. echo "<tr>";
  38. echo "<td>";
  39. echo $broj;
  40. echo "<td>";
  41. echo "X";
  42. echo "<td>";
  43. echo $a;
  44. echo "<td>";
  45. echo "=";
  46. echo "<td>";
  47. echo $rez;
  48. echo "</tr>";
  49.  
  50. }
  51.  
  52. }
  53. ?>
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement