Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z formularzem
david8213
post
Post #1





Grupa: Zarejestrowani
Postów: 308
Pomógł: 0
Dołączył: 9.12.2009

Ostrzeżenie: (10%)
X----


index.php
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 ">


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>


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

Ten post edytował david8213 19.12.2009, 16:40:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 22:27