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>Maratonci</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>Ime: <input type="text" name="ime" /></p>
- <p>Prezime: <input type="text" name="prezime" /></p>
- <p><input type="submit" name="submit" value="Upisi" /></p>
- <?php
- if(!empty($_POST["ime"]) && !empty($_POST["prezime"]))
- {
- $ime = $_POST["ime"];
- $prezime = $_POST["prezime"];
- echo "<table border = '1'> ";
- echo "<th>";
- echo "Ime i prezime";
- $file = fopen("maratonci.txt", "a+");
- $txt = $ime . " " . $prezime . "\n";
- fwrite($file, $txt);
- fclose($file);
- $file = fopen("maratonci.txt", "r");
- while (! feof($file)) {
- $line = fgets($file);
- echo "<tr>";
- echo "<td>";
- echo $line;
- }
- fclose($file);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement