December 17th, 2012, 02: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, 07:02 AM
Um, how about pressing ctrl + p in your browser?
December 17th, 2012, 07:11 AM
Tried, but it prints EVERYTHING! That includes, images, any buttons, menus etc.!
Originally Posted by Jacques1
December 17th, 2012, 12:59 PM
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, 02:45 AM
THANKS!!! Looks easy! Will try it out!
Originally Posted by requinix