fwrite() question
| From: | Adam Williams | Date: | Tue, 01 Jul 2003 14:03:29 +0000 |
| Subject: | fwrite() question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-153554@lists.php.net to get a copy of this message | ||
Hello,
I have a block of code:
<?php
if ($_POST['news'])
{
$fp = fopen( "news.txt", "w");
$success = fwrite( $fp, "$POST_['news']" );
fclose($fp);
if (!success)
{
echo "<p>unable to write to news.txt</p>";
exit;
}
Header("Location: http://archives1.mdah.state.ms.us/news.php"
);
}
?>
and when I access it, I get the error:
Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING' in /usr/local/apache2/htdocs/updatenews.php on line 5
and line 5 is:
$success = fwrite( $fp, "$POST_['news']" );
which looks ok to me. When I take out the " " around $POST_['news'] it
doesn't generate an error, but then it doesn't write anything to news.txt.
news.txt is owned by nobody with 755 and apache runs as nobody.
I'd appreciate any help. Thanks!
Adam