PHP
if($_POST['kommentar']=="" AND $_POST['name']==""){
//echo .....
}
else{
$handle = fopen ("linksammlung.txt", "a");
fwrite ($handle,$datum);
fwrite ($handle,"|");
fwrite ($handle,$uhrzeit);
fwrite ($handle,"|");
fwrite ($handle,$_POST['name']);
fwrite ($handle,"|");
fwrite ($handle,$_POST['kommentar']);
fwrite ($handle,"\r\n");
fclose ($handle);
$_POST['kommentar']="";
$_POST['name']="";
}
echo "<form name=\"kommentar\" action=\"(selbe).php\" method=\"post\" enctype=\"text/html\" >";
echo "<p>Name:</p>";
echo "<input type=\"text\" name=\"name\" value=\"\" size=\"20\" maxlength=\"50\"/>";
echo "<p>Nachricht:</p>";
echo "<textarea name=\"kommentar\" rows=\"5\" cols=\"50\"></textarea><br />";
echo "<input type=\"submit\" name=\"senden\" value=\"Senden\" />";
echo "</form>";
//txt Kommentare Auslesen
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th>";
echo "Datum:";
echo "</th>";
echo "<th>";
echo "Uhrzeit:";
echo "</th>";
echo "<th>";
echo "Name:";
echo "</th>";
echo "<th>";
echo "Nachricht:";
echo "</th>";
echo "</tr>";
echo "</thead>";
$fd = fopen("linksammlung.txt", "r");
while ($inhalt=fgets ($fd,4096))
{
list ($gesendetdatum,$gesendetzeit,$absender,$kommentar) = explode ("|",$inhalt);
echo "<tr>";
echo "<td>";
echo "$gesendetdatum ";
echo "</td>";
echo "<td>";
echo "$gesendetzeit ";
echo "</td>";
echo "<td>";
echo "$absender ";
echo "</td>";
echo "<td>";
echo "$kommentar";
echo "</td>";
echo "</tr>";
}
echo "</table>";
Alles anzeigen
wenn ich einmal etwas gesendet habe, dann f5 drücke sendet er es nochmal. und das erste mal kommen fehler(nach dem ersten senden sind sie weg).
er soll ja scho mehrere sachen nach einander senden können, wenn er mehr kommentieren will.