Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Nasumican zbir</title>
- </head>
- <style>
- table, th, tr {
- border: 1px solid black;
- border-collapse: collapse;
- }
- th, td {
- padding: 5px;
- text-align: center;
- }
- </style>
- <body>
- <form action="index.php" method="post">
- <p>Zbir nasumicno generisanih 6 cifara</p>
- <p><input type="submit" name="submit" value="Generisi" /></p>
- <?php
- if(isset($_POST["submit"])) {
- $broj1 = rand(1, 6);
- $broj2 = rand(1, 6);
- $broj3 = rand(1, 6);
- $broj4 = rand(1, 6);
- $broj5 = rand(1, 6);
- $broj6 = rand(1, 6);
- $zbir = $broj1 + $broj2 + $broj3 + $broj4 + $broj5 + $broj6;
- echo "<table border = '1'>";
- echo "<th> Broj 1";
- echo "<th> Broj 2";
- echo "<th> Broj 3";
- echo "<th> Broj 4";
- echo "<th> Broj 5";
- echo "<th> Broj 6";
- echo "<th> Zbir";
- echo "<tr>";
- echo "<td>", $broj1;
- echo "<td>", $broj2;
- echo "<td>", $broj3;
- echo "<td>", $broj4;
- echo "<td>", $broj5;
- echo "<td>", $broj6;
- echo "<td>", $zbir;
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement