Re: fwrite() question

From: Date: Tue, 01 Jul 2003 14:06:02 +0000
Subject: Re: fwrite() question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153555@lists.php.net to get a copy of this message
you should use $_POST['news'] instead of "$POST_['news']". ans you also should'nt put " around variables ;) ------------------------ > 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 ------------------------ -- Adrian mailto:adrian@planetcoding.net www: http://www.planetcoding.net www: http://www.webskyline.de

« previous php.general (#153555) next »