note 15883 added to function.fopen
| From: | Flok at chello dot at | Date: | Sat, 06 Oct 2001 17:25:17 +0000 |
| Subject: | note 15883 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18644@lists.php.net to get a copy of this message | ||
how can i make my script to put the text at the beginning of my txt file without deleting the file ?
so what do i have to do ? cause "aw" does not work
<?php
if($action == add){
$fp = fopen("news.txt", "a+");
$data = "<tr><td><img
src=\"symbole/$bild.gif\"> <font color=\"#F6A800\"
size=+1><b>$title </b></font><br><font color=\"#777777\"
size=\"-2\">postet by <a href=\"mailto:$mail\">$name</a>
</font></td></tr><tr><td> $news <br><hr bordercolor=black
width=100% align=center><font size=\"-2\"><a
href=$cid.php4>(Kommentare)</a></td></tr>\n";
fputs($fp, $data);
fclose($fp);
echo"News added! <a href=index.php4>>>back</a>";
}
else{
echo"<form action=$PHP_SELF?action=add method=post><br>";
echo"Gelber Titel<br>";
echo"<input type=text name=title value=TITEL><br>";
echo"Name<br>";
echo"<input type=text name=name value=Name><br>";
echo"Vollständige Mailadresse<br>";
echo"<input type=text name=mail value=flok@chello.at><br>";
echo"Kommentar ID (bitte leer lassen)<br>";
echo"<input type=text name=cid value=comments1><br>";
echo"<textarea rows=5 cols=40 name=news
wrap=VIRTUAL>Text</textarea><br>";
echo"<input type=submit name=submit value=Abschicken><br><br>";
}
?>
--
http://www.php.net/manual/en/function.fopen.php
http://master.php.net/manage/user-notes.php?action=edit+15883
http://master.php.net/manage/user-notes.php?action=delete+15883
http://master.php.net/manage/user-notes.php?action=reject+15883