w pliku index:
Kod: Zaznacz cały
<form action="przegladaj.php" method="post" />
<p class="style2">
<span class="style3">Wpis: </span>
<input type="text" size="14" name="dodaj_wpis" class="style4" style="height: 21px; width: 333px" /></p>
<p class="style2">
<span class="style3">Dodał:</span>
<input type="text" size="14" name="dodaj_autora" class="style4" style="height: 21px; width: 333px" /></p>
<p class="style2">
<input type="submit" value="Dodaj" class="style5" style="background: #800000 url('pattern_102.gif'); border: thick double; width: 111px; height: 32px; color: #FFFFFF; font-family: 'Microsoft JhengHei'; letter-spacing: normal; font-size: large; font-style: normal; font-weight: bold; text-decoration: blink;" /></form></p>
</body></html>Kod: Zaznacz cały
...
<?php
extract($_REQUEST);
$tresc = $dodaj_wpis;
$imie = $dodaj_autora;
$outputstring = "$tresc\t$imie\n";
$filename = "$_SERVER[DOCUMENT_ROOT]\kodeks.txt";
$filehandle = fopen($filename, 'ab');
$text = file_get_contents($filename);
echo "<pre>$text</pre>";
fclose($filehandle);
?>
<?php
$filename = 'kodeks.txt';
$filehandle = fopen($filename, 'rt');
$contents = fread($filehandle, filesize($filename));
print "<pre>$contents</pre>";
fclose($filehandle);
?>