I have been googling, rtfm'ing, rtfw'ing and doing everything I can to
get this working.
Server:
Apache 2.0.50
PHP 4.3.4
PDFLib 4.0.3
MySQL 4.0.17
Client:
Windows XP Pro, Service Pack 2
IE 6.0.28
Code:
<?php
// Connect to the DB and retrieve the records we need
$db = mysql_connect("localhost", "root", "**********");
mysql_select_db("EngInfo",$db);
// get the count of the number of rows of data
$query = "SELECT count(*) as count FROM brw";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$numrows = $row['count'];
$result = mysql_query("SELECT * FROM brw WHERE id=2 ORDER BY id ASC");
//generate the headers to help a browser choose the correct application
header( 'Content-type: application/msword' ); header(
'Content-Disposition: inline, filename=brwrep.rtf');
// open our template file
$filename = 'LChace.rtf';
$fp = fopen ( $filename, 'r' );
//read our template into a variable
$output = fread( $fp, filesize( $filename ) );
fclose ( $fp );
while($myrow = mysql_fetch_array($result)) {
// replace the place holders in the template with our data
$output = str_replace( '<<bid>>', strtoupper( $myrow['bid'] ), $output
);
$output = str_replace( '<<bdrep>>', $myrow['bdrep'], $output );
$output = str_replace( '<<recdate>>', $myrow['recdate'], $output );
$output = str_replace( '<<solic>>', $myrow['solic'], $output );
$output = str_replace( '<<closedate>>', $myrow['closedate'], $output
);
$output = str_replace( '<<clin>>', $myrow['clin'], $output );
$output = str_replace( '<<nsn>>', $myrow['nsn'], $output );
$output = str_replace( '<<qty>>', $myrow['qty'], $output );
$output = str_replace( '<<nomen>>', $myrow['nomen'], $output );
$output = str_replace( '<<slp>>', $myrow['slp'], $output );
}
// send the generated document to the browser
echo $output;
?>
The above code is called via http://servername/rtf.php?id=2. This code
works with every browser I try EXCEPT IE 6 and wouldn't you know it,
IE6 is the <cough>preferred</cough> browser on our LAN.
Whenever I attempt to use this script under IE6, the browser wants to
download the URL instead of the filename (brwrep.rtf). If I
download/view with Mozilla, all is well, I can save the freakin file
and then open it with word without issue.
My travels around google and this news group lead me to a lot of folks
having the same problem, however it would appear that nobody has come
up with a solution.
HOW/CAN this be fixed, worked around or?
TIA for any suggestions!
rk