chiefwiggem
Grünschnabel
Hallo ihr Lieben
Ich habe mir ein Formular erstellt und nach diesem Tutorial das lesen und schreiben in eine Datei erstellt. Nur geht es nicht kann mir da mal einer helfen?
Hier mein Formular
und hier das PHP-Script
Ich hoffe Ihr seht einen Fehler! Wenn man da den halben Tag drauf guckt sieht irgend wann alles gleich aus.
Ich habe mir ein Formular erstellt und nach diesem Tutorial das lesen und schreiben in eine Datei erstellt. Nur geht es nicht kann mir da mal einer helfen?
Hier mein Formular
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
<!--
Include the WYSIWYG javascript files
-->
<script type="text/javascript" src="scripts/wysiwyg.js"></script>
<script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>
<!--
Attach the editor on the textareas
-->
<script type="text/javascript">
WYSIWYG.attach('news'); // default setup
// Use it to display an iframes instead of a textareas
//WYSIWYG.display('all', full);
</script>
</head>
<body>
<form action="test.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="right">LOGO</td>
</tr>
<tr>
<td width="10%"> </td>
<td style=" font-weight:bold">Thema:</td>
<td width="10%"> </td>
</tr>
<tr>
<td width="10%"> </td>
<td height="25px" align="center" valign="middle">
<input name="thema" type="text" id="thema" style="width:100%; height:20px;" />
</td>
<td width="10%"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="10%"> </td>
<td style="font-weight:bold;">Nachricht:</td>
<td width="10%"> </td>
</tr>
<tr>
<td width="10%"> </td>
<td height="210" align="center" valign="middle">
<textarea name="news" id="news" style="width:100%; height:200px;"></textarea>
</td>
<td width="10%"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="10%"> </td>
<td><input type="Submit" name="" value="speichern"></td>
<td width="10%"> </td>
</table>
</form>
</body>
</html>
PHP:
<?php
ob_start();
$datei = "themen/news.txt";
if ( $post)
{
$fp = fopen ( "$datei","a+");
$news = str_replace("\r","<br>",$news);
$news = str_replace("\n","<br>",$news);
$data = "thema|-|news|-|\n\r;
fputs($fp,$data);
fclose ($fp);
}
if(file_exists($datei))
{
$inhalt = file($datei);
$anzahl = count($inhalt);
for($i = 0; $i < $anzahl; $i++)
{
$newinhalt = array_reverse($inhalt);
$eintrag = explode("|-|",$newinhalt[$i]);
$thema = $eintrag[0];
$news = $eintrag[1];
echo "<center><b>$eintrag[0]</b></center><br>$eintrag[1]<br><br>";
}
}
else
{
echo"Es wurde keine Datei gefunden";
}