Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001032

Re: [PHP] please help with this simple problem From: adam (vawan <email protected>)
Date: 03/22/01

it works now, only it's earasing everything and then writing to the file.
i think we have almost got this figured out. here's what the code looks like
for the entire tag...
-----------------------------------

<?
if ($message)
 {
 /* uncomment the next two lines to strip out html from input */
 $name = strip_tags($name);
 /* $message = strip_tags($message); */
 $message = ereg_replace("\r\n\r\n", "\n<P>", $message);
 $date = date("l, F j Y, h:i a");
 $message = "<font size=2 face=verdana><b><a href=mailto:$email>$name</a>
</b><font size=1> -- $date</font>\n
 <blockquote>\n
  $message\n
 </blockquote></font>\n<hr noshade color=white size=1 width=100%>\n";

 $fname = basename($PHP_SELF) . ".comment";
 $fsize = filesize($fname);
 $fp = fopen(basename($fname),"w+");
 $data = fread($fp,$fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 }
 <email protected>(basename(($PHP_SELF . ".comment")));
?>

--------------------

""adam"" <adam <email protected>> wrote in message
news:99cmfj$mai$1 <email protected>
> i am coding a simple script to post a text area into a file. it works, but
> it posts it at the bottom and i wanted to have it post to the top of the
> text already there..
>
> here's a snip of the important part of the script:
>
> $fp = fopen (basename($PHP_SELF) . ".comment", "a");
> fwrite ($fp, $message);
> fclose ($fp);
> }
>
> any help would be much appreciated
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>