Guest User

Warum geht das nicht?

a guest
May 21st, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <html>     
  2.         <form action="" method="post">
  3.   <p>Wunsch:<br><input name="textfeld" type="text" size="30" maxlength="30"></p>
  4.   <input type=submit>
  5. </form>
  6.  
  7. <?php
  8.  
  9.    $text = $_POST["textfeld"];
  10.    if ($text == "") {
  11.    echo "Du musst etwas in das Feld schreiben";
  12.    exit;
  13.    }
  14.    $datei = fopen("datei.txt", "a");
  15.    if (!$datei) {
  16.       echo "Die Datei konnte zum Schreiben nicht geöffnet werden.";
  17.    } else {
  18.      fwrite($datei, "$text");
  19.      fclose($datei);
  20.      echo "Datei erfolgreich beschrieben.";
  21.    }
  22. ?>
  23.  
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment