Ok so I changed my code around and now I get a totally different error.
Parse error : syntax error, unexpected T_VARIABLE in /usr/local/httpd/htdocs/word.php on line 24
Other than that my code seems wrong to me so if you can comment on that too.
<?php
ob_start();
/* Program: retrieve.php*/
include("long.inc");
{}
$cxn = mysqli_connect($host, $user,$passwd,$dbname)
or die ("Couldn't connect to server.");
$query = "SELECT firstname,lastname,address,startdate,enddate,salary,contractlocation,managingsection,jobtitle FROM personalinfo WHERE familyname='$_POST[familyname]' AND firstname='$_POST[firstname]'";
$result = mysqli_query($cxn, $query);
$fp = fopen("contract.doc","r"); // $fp is now the file pointer to file $filename
$content = $fp
$content = ereg_replace("<name>",$firsntname,$content);
$content .= ereg_replace("<name>",$lastname,$content);
$content .= ereg_replace("<address>",$firsntname,$content);
$content .= ereg_replace("<startdate>",$startdate,$content);
$content .= ereg_replace("<startdate>",$startdate,$content);
$content .= ereg_replace("<enddate>",$enddate,$content);
$content .= ereg_replace("<jobtitle>",$jobtitle,$content);
$content .= ereg_replace("<salary>",$salary,$content);
$content .= ereg_replace("<contractlocation>",$contractlocation,$content);
$content .= ereg_replace("<jobtitle>",$jobtitle,$content);
$content .= ereg_replace("<startdate>",$startdate,$content);
$content .= ereg_replace("<enddate>",$enddate,$content);
$content .= ereg_replace("<managingsection>",$managingsection,$content);
echo $content;
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=Contract.doc");
header("Pragma: no-cache");
header("Expires: 0");
fclose($fp);
?>
Sorry for my ignorance and thanks in advance