I'm Learnin php, been readin tuts and whatnot.
I wrote a script that uses a html form and when you type in the news you want to submit then click submit it runs newnews.php which remembers what you typed using $_POST then writes it to my news.php fwrite($fh, $stringData); but i want to use 'r+' instead of 'a' to write the news. But when I use 'r+' it tends to overwrite the news I've already posted. Is there any way around it overwriting my current news I've already posted?
Heres the newnews.php
PHP Code:<?php
$newPost = $_POST['newPost'];
$myNews = "news.php";
$fh = fopen($myNews, 'a'); /*This is where I want it to be r+*/
$stringData = "<center>";
fwrite($fh, $stringData);
$stringData = '<img src="images\spacer.jpg">';
fwrite($fh, $stringData);
$stringData = "<br />";
fwrite($fh, $stringData);
$stringData = date("m/d/y");
fwrite($fh, $stringData);
$stringData = "-Admin<br />";
fwrite($fh, $stringData);
$stringData = $newPost;
fwrite($fh, $stringData);
$stringData = "<br />";
fwrite($fh, $stringData);
$stringData = '<img src="images\spacer.jpg">';
fwrite($fh, $stringData);
$stringData = "</center>";
fwrite($fh, $stringData);
fclose($fh);
echo "Succesfully Submited.<br />";
echo '<a href="news.php">Check what you posted</a>';
?>
