Advertisement
mcnc

maratonci

Nov 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 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>Maratonci</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. <form action="index.php" method="post">
  25. <p>Ime: <input type="text" name="ime" /></p>
  26. <p>Prezime: <input type="text" name="prezime" /></p>
  27. <p><input type="submit" name="submit" value="Upisi" /></p>
  28. <?php
  29. if(!empty($_POST["ime"]) && !empty($_POST["prezime"]))
  30. {
  31. $ime = $_POST["ime"];
  32. $prezime = $_POST["prezime"];
  33.  
  34. echo "<table border = '1'> ";
  35. echo "<th>";
  36. echo "Ime i prezime";
  37. $file = fopen("maratonci.txt", "a+");
  38. $txt = $ime . " " . $prezime . "\n";
  39. fwrite($file, $txt);
  40. fclose($file);
  41. $file = fopen("maratonci.txt", "r");
  42. while (! feof($file)) {
  43. $line = fgets($file);
  44. echo "<tr>";
  45. echo "<td>";
  46. echo $line;
  47. }
  48. fclose($file);
  49. }
  50. ?>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement