format output using fwrite function
Posted: Tue Jul 29, 2003 6:01 am
I am trying to format a newly created file by send ing a template to be written at the same time as a I send the data to be written to a file.
However the file still appears as a basic text window, and whats worse I lose the data that is entered - any idea why?
Only the first 3 characters of the $news variable are written to th newly created file.
However the file still appears as a basic text window, and whats worse I lose the data that is entered - any idea why?
Code: Select all
<?PHP
$filename='/home/.sites/14/site467/web/test/test1/'.$thename .'.php';
$fp = fopen('list.dat',"a+");
$line .= "|" . $HTTP_POST_VARS['thename'];
$line .= "\r\n";
fwrite($fp,$line);
fclose($fp);
$hoog = '/home/.sites/14/site467/web/template.php';
$Template = fopen($hoog, "r");
$fw = fopen($filename ,'w+');
$line1 .= "|" . $HTTP_POST_VARS['news'];
$line1 .= "\r\n";
fwrite($fw ,$line1, $Template);
fclose($fw);
?>