December 17th, 2012, 01:32 AM
Need help with printing a report using PHP
I am a relative newbie to PHP.
I have successfully stored data in MySQL tables using PHP script that uses Form. I can also see the data on the screen when it is fetched using mysql commands. I am using PHP 5.4.3 and MySQL 5.5.24.
Now, I want the same screen display of the data (that appears neatly in columns) to be printed like a report on a local printer. How do I go about it?
Any clues, help will be greatly appreciated!
Thanks in advance!
December 17th, 2012, 06:02 AM
Um, how about pressing ctrl + p in your browser?
December 17th, 2012, 06:11 AM
Tried, but it prints EVERYTHING! That includes, images, any buttons, menus etc.!
Originally Posted by Jacques1
December 17th, 2012, 11:59 AM
Write a stylesheet for printing which hides whatever you wouldn't want printed. To be clear I mean to keep your site exactly as it is and make the stylesheet hide things, not to write a complete replacement for the "main" stylesheet.
Then "@media print" it or reference it with
<link rel="stylesheet" type="text/css" href="/path/to/file.css" media="print" />
December 18th, 2012, 01:45 AM
THANKS!!! Looks easy! Will try it out!
Originally Posted by requinix