Advertisement
mcnc

nasumican zbir

Nov 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 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>Nasumican zbir</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.  
  24. <body>
  25. <form action="index.php" method="post">
  26. <p>Zbir nasumicno generisanih 6 cifara</p>
  27. <p><input type="submit" name="submit" value="Generisi" /></p>
  28. <?php
  29.  
  30. if(isset($_POST["submit"])) {
  31.  
  32. $broj1 = rand(1, 6);
  33. $broj2 = rand(1, 6);
  34. $broj3 = rand(1, 6);
  35. $broj4 = rand(1, 6);
  36. $broj5 = rand(1, 6);
  37. $broj6 = rand(1, 6);
  38. $zbir = $broj1 + $broj2 + $broj3 + $broj4 + $broj5 + $broj6;
  39.  
  40. echo "<table border = '1'>";
  41. echo "<th> Broj 1";
  42. echo "<th> Broj 2";
  43. echo "<th> Broj 3";
  44. echo "<th> Broj 4";
  45. echo "<th> Broj 5";
  46. echo "<th> Broj 6";
  47. echo "<th> Zbir";
  48. echo "<tr>";
  49. echo "<td>", $broj1;
  50. echo "<td>", $broj2;
  51. echo "<td>", $broj3;
  52. echo "<td>", $broj4;
  53. echo "<td>", $broj5;
  54. echo "<td>", $broj6;
  55. echo "<td>", $zbir;
  56.  
  57. }
  58. ?>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement