FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Table data print feature using php or javascript?





bukaida
I need to have a print feature on a webpage that only prints one of the tables on the page.

The data within this table is updated using an administrative tool, so the printer friendly version needs to have the most up to date data.

Is there a way to do this using php or javascript?
Nemesis234
what do you mean by table? as you using an sql database? how is the table set out?
bukaida
Sorry for the confusion. The table is not mysql table. It is the table tag of html. I am displaying the result in a tabular form (From mysql database) using <table><tr><td>......etc. Now the html page also contain other headings which are outside the table area. I do not want them to be printed.Also only the data of the table should be printed retaining the structure (and heading) without table background.Is it possible ? Thanx.
Nemesis234
yea... your really not explaining yourself very well. perhaps images or a link to the page in question would help. or write out what you have in psudo code and what you want it to do.

just saying i have a header above a table but dont want the header printed leaves me to the answer of delete the header, which surely cant be the answer you are after.
bukaida
Sorry again. I am posting an image of the output to clarify it further.


Now only the datas inside the table needs to be printed out with their corresponding column heading without the coloured background inside the table cells. Hope the situation is more clear this time.
jmraker
You can use a printed media stylesheet to have the print version of the page differ from the screen version, where you can make changes like make parts of it not display

Code:
@media print{
   body{
       font-size: 12px;
      background-color: white;
   }
   #header, #footer {
      display: none;
   }
   th {
      display: none;
   }
   td {
      background-color: white;
   }
}


Where everything in a <div id="header"> ... </div> wouldn't print

You can test it out with the browser's print preview, so you don't need to waste paper until you get it working right.

http://www.w3.org/TR/CSS2/media.html
bukaida
Many thanks. I am going through the link sent by you.
Related topics
[tutor] How to protect images without htaccess using PHP
Using PHP
Includ Images using PHP.
How to start using PHP? Help!
Website Designing using PHP
how can i setup a page break for printer on html using php ?
Question about forms on websites?
Communicating between web pages
Using Javascript to Encrypt Data then POST to PHP
Using php to change content of a .txt
"Drop Down List Box" Using PHP and MySql
i want to dezign a website using php
Parsing XML Data using Regular Expressions
Fetch Alexa Rank of website using PHP function easily
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.