Kod
<center><form method="post" action="notki.php">
<textarea cols="30" rows="6" name="notka"></textarea><br />
<input type="submit" value="Dodaj">
</form>
<?php
$notka = $_POST['notka'];
$file = "notki.txt";
$nowedane = "<br />$notka<br />-----------------------------------";
$nowedane .= $staredane;
$fp = fopen($file, "a+");
flock($fp, 2);
fwrite($fp, $nowedane);
flock($fp, 3);
fclose($fp);
include "notki.txt";
?></center>
<textarea cols="30" rows="6" name="notka"></textarea><br />
<input type="submit" value="Dodaj">
</form>
<?php
$notka = $_POST['notka'];
$file = "notki.txt";
$nowedane = "<br />$notka<br />-----------------------------------";
$nowedane .= $staredane;
$fp = fopen($file, "a+");
flock($fp, 2);
fwrite($fp, $nowedane);
flock($fp, 3);
fclose($fp);
include "notki.txt";
?></center>
Problem polega na tym, że gdy wchodzę do pliku w którym jest ten kod, pusty wpis zostaje dodany, jak temu zapobiec?