Re-create the file. You're most of the way there.
if( $formSubmit )
{
echo "Your news has been processed.";
$filename = "news.txt";
//This is simpler than messing with an array of the original content.
$fp = fopen ($filename, "r");
$newsSubmit = fread ($fd, filesize ($filename));
fclose ($fp);
$fp = fopen( $filename, "w" ); // change append to write (a to w)
fwrite( $fp, $frmName ); //write the new
fwrite( $fp, $newsSubmit); //write the old
fclose( $fp );
}
else
{
include ( "newsForm.php" );
}
if you want to use fseek, then try this:
if( $formSubmit )
{
echo "Your news has been processed.";
$filename = "news.txt";
//This is simpler than messing with an array of the original content.
$fp = fopen ($filename, "r+");
$newsSubmit = fread ($fd, filesize ($filename));
fseek($fp,0);
fwrite( $fp, $frmName ); //write the new
fwrite( $fp, $newsSubmit); //write the old
fclose( $fp );
}
else
{
include ( "newsForm.php" );
}
""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ok, with this fseek..
>
> Could you give me an example of how to implement it?
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]