error with writing to this file from the top without...
Posted: Mon Apr 28, 2003 8:10 pm
i'm having an error with writing to this file from the top without deleting text already on the file... i have used all of the fopen functions r,r+,w, etc. none of them work. they all either delete the current text or write from the bottom of the file. it might have something to do with usign fputs().. i duno im lost. =\. here is my php code
Code: Select all
<?
$xname = "$name";
$xmsg = "$msg";
$xemail = "$email";
$xurl = "$url";
$glog = "guestlog.php";
$fp = fopen ($glog, "r+");
$split = " - ";
if (!$xname || !$xmsg) {
echo("one or more required fields were left blank.");
}
if ($xname || $xmsg) {
fputs ($fp,"<a href="mailto:$xemail">$xname</a>$split<a href="$xurl">www</a>$split$xmsg<br><br>");
echo("thank you for your comment, i really appreciate your feedback. <a href="guestlog.php" target="shoutbox">click here</a> to view your comment.");
exit;
}
?>