fwrite: Want to write PHP generated output to file
| From: | Martin Cameron | Date: | Fri, 22 Sep 2000 20:10:17 +0000 |
| Subject: | fwrite: Want to write PHP generated output to file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24421@lists.php.net to get a copy of this message | ||
I am in the process of producing a dynamically generated web page. I
want the results to be sent to a file. It doesn't do it.
Here's the code:
<?
define (INITIAL_PAGE,0);
define (TR_TD_FORM,1);
define (MAKE_PAGE,2);
function initial_page(){
global $PHP_SELF;
printf ("<FORM ACTION = \"%s?action=%d\" METHOD = \"post\"
>\n",$PHP_SELF,TR_TD_FORM);
print "How many Fields in the first row of Data: \n";
print "<INPUT TYPE = \"text\" NAME = \"no_of_data_fields\" VALUE =
\"\">\n";
print "<INPUT TYPE = \"submit\" VALUE = \"Submit\">\n";
print "</form>\n";
}
function tr_td_form($no_of_data_fields){
global $no_of_data_fields;
global $PHP_SELF;
$i=0;
<snip form code>
}
***** This is where I am trying to write to a file ******
The file is touched but no output written to it
Any ideas would be appreciated.
function make_page(){
$web_page=make_page2();
print "hello world";
touch("public_html/home.html");
$file="public_html/home.html";
$fp = fopen($file,"w+");
fwrite($fp, make_page2());
fclose($fp);
}
function make_page2(){
global $colors,$heading etc;
<snip>
usual php/html output here using form variables
</snip>
print "</center>\n";
print "</body>\n";
print "</html>\n";
}
Regards
Martin Cameron