Kod
<FORM ACTION="return.php" METHOD="POST">
<?
$file = "dane.txt";
$myFile = fopen($file, "r");
$myLine = fgets($myFile);
// $myLine = ereg_replace("<br>", "", $myLine);
print("<textarea name=Tresc rows=26 cols=106>$myLine</textarea>");
fclose($myFile);
?>
<INPUT TYPE=SUBMIT VALUE= " Zapisz ">
<?
$file = "dane.txt";
$myFile = fopen($file, "r");
$myLine = fgets($myFile);
// $myLine = ereg_replace("<br>", "", $myLine);
print("<textarea name=Tresc rows=26 cols=106>$myLine</textarea>");
fclose($myFile);
?>
<INPUT TYPE=SUBMIT VALUE= " Zapisz ">
return.php
Kod
<HTML><HEAD>
<?
$fp = fopen ("dane.txt", "w"); //przed zapisaniem danych czy?ci plik
fwrite($fp, NULL); //przed zapisaniem danych czy?ci plik
$Tresc = ereg_replace("\n", "", $Tresc); // enter zamienia w woln? przestrzeń
$Tresc = stripslashes($Tresc); // usunięcie powielania slash'ów "/"
$nazwa = "dane.txt";
$wpis = "$Tresc";
$myFile = fopen($nazwa, "r+");
fputs($myFile, $wpis);
fclose($myFile);
?>
<script LANGUAGE="JavaScript">
if(top.frames.length==0) {
window.location.href="index.php"; }
else { document.write("error.htmll"); }
</SCRIPT>
</BODY></HTML>
<?
$fp = fopen ("dane.txt", "w"); //przed zapisaniem danych czy?ci plik
fwrite($fp, NULL); //przed zapisaniem danych czy?ci plik
$Tresc = ereg_replace("\n", "", $Tresc); // enter zamienia w woln? przestrzeń
$Tresc = stripslashes($Tresc); // usunięcie powielania slash'ów "/"
$nazwa = "dane.txt";
$wpis = "$Tresc";
$myFile = fopen($nazwa, "r+");
fputs($myFile, $wpis);
fclose($myFile);
?>
<script LANGUAGE="JavaScript">
if(top.frames.length==0) {
window.location.href="index.php"; }
else { document.write("error.htmll"); }
</SCRIPT>
</BODY></HTML>
Dlaczego gdy wpisuje tekst a następnie klikam ENTER to po nim już powyższy skrypt nie zapamiętuje teksu w pliku.
Zapamiętuje mi tylko tekst do momentu naciśnięcia enter, za nim już nic nie pamięta