Hi all,
I have created a php script to generate a rtf file(in word doc format).
however, when the word doc opens there is a load of messy text.
Why is this??
Here is my code:
<?php
// create variable names
$client = $_POST['client'];
$director = $_POST['director'];
if (!$client || !$director)
{
echo 'Error';
}
else
{
header('Content-type: application/msword');
header('Content Disposition: inline, filename=clients.rtf');
$date = date('F, d, Y');
$filename = 'clients.rtf';
$fp = fopen ($filename, 'r');
$output = fread($fp, filesize($filename));
fclose($fp);
$output = str_replace('<<Client>>', $client, $output);
$output = str_replace('<<Director>>', $director, $output);
$output = str_replace('<<mm/dd/yyyy>>', $date, $output);
echo $output;
}
?>