Jump to content

[SOLVED] Included file not appearing in print preview or actually printing in IE7


tpimental

Recommended Posts

I searched high and low for others experiencing this problem, but it must be rare (or the fact that "print" can mean a lot of things in PHP is f-ing up my searches).

 

At any rate, I have a "printer friendly" version of a page that includes a file based on a querystring.  This all works fine in FF, but when I go to print the page only the header and footer appear on the printed page (or in IE's print preview).

 

Has anyone run into something like this? 

Probably this has nothing to do with php. Have you set a stylesheet for the "printer friendly" version, or you're just generating a page php. You can have two stylesheets on your page, one for the screen and one for the printer (media="print"). That way you don't need to run another query and generate a "printer friendly" new page.

The strange thing is that it works fine in FF.  Any way, here's some code.  Let me know if anything stands out at you.

 

<h2>View Report</h2>
<form>
<input type="button" value="Print This Page" onClick="window.print()" />
</form>
<div class="print"><a href="<?php echo $_SERVER['REQUEST_URI']; ?>" onClick="window.print();return false">Print Report <img src="images/print.png"></a></div>
<form>
<?php

$reports_data= $db->get_results("select value_name,value from report_data where report_id=$report_id");
foreach ( $reports_data as $data )
{
           // Access data using object syntax
  $str.=$data->value_name."=".stripslashes($data->value)."&";
  
};
echo parse_str($str);

if ($report_type == 'inspection_report') {
include 'view-inspection_report.php';
} elseif ($report_type == 'valve_test') {
include 'view-valve_test.php';
} elseif ($report_type == 'dry_pipe_valve_test') {
include 'view-dry_pipe_valve_test.php';
} elseif ($report_type == 'fire_pump_test') {
include 'view-fire_pump_test.php';
}

?>

</form>

I guess $report_id is set somewhere above the code you provided.

 

parse_str() doesn't return any values, so what's the point of echoing it?

 

Let me explain the page a bit more.  $report_id is pulled from the querystring and is used to call a database with more than 100 value name/value pairs which are displayed using parse_str() in the included files.  The included files are simply large table formatted forms.

 

The pages render fine in both IE and FF on the page, but when I try to send them to my printer or print preview in IE, I lose everything within the included files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.