|
Posted by vdP on 10/28/26 11:33
Brian wrote:
> ok that worked i changed the code a little bit, now I'm getting an
> error like this:
> Fatal error: Function name must be a string in
> /usr/local/www/billcalculation.php on line 36
>
> $fp = fopen($_POST['month'] . ".html","a+");
> $fwrite ($fp, $data);
> fclose($fp);
>
> $data = print "Apartment: $apartment_rent"; //want it to print that to
> the new .html file.
> thats what I have, why am I getting this error?
>
A few things:
1. Read http://www.safalra.com/special/googlegroupsreply/ about how to
use Google groups.
2. I hope you defined $data before you try to write it to the new html-file.
3. (By far the most important point.) The print function outputs the
given string as normal html, i.e. you will see it in your browser if you
open billcalculation.php . The statement above assigns the result of the
print function (which is always the integer 1) to $data. Hence, the
number 1 should be written to the new html-file. Instead use
$data="Apartment: $apartment_rent";
$fwrite ($fp, $data);
(And if you want to show it in billcalculation.php as well, throw in
print $data; )
Hope this helps.
vdP
[Back to original message]
|