Professional Documents
Culture Documents
php -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Formularz</title>
<style>
/* Dodaj odpowiednie style CSS według potrzeb */
</style>
</head>
<body>
<h1>Formularz</h1>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label for="name">Imię i nazwisko:</label>
<input type="text" id="name" name="name" required>
<button type="submit">Wyślij</button>
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
<h2>Zebrane dane</h2>
<ul>
<?php
// Odczytaj dane z pliku
$lines = file("dane.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// Wyświetl dane
foreach ($lines as $line) {
echo "<li>$line</li>";
}
?>
</ul>
</body>
</html>