I want to print a particular <td> only in php/javascript
need suggestions

Recommended Answers

Give it a specific classname, and use the print css to disable everything but your td.

Jump to Post

Post your entire code.

Jump to Post

All 6 Replies

Give it a specific classname, and use the print css to disable everything but your td.

<table>
<tr>
<td>
list coming from database//want to print only that list
</td>
<tr>
</table>

Where do you want to print?
use code tags to post your code

<table>
<tr>
<td id="printTD">
list coming from database//want to print only that list
</td>
<tr>
</table>

You can get that content using javascript as follows

value=document.getElementById("printTD").innerHTML;
alert(value);

Use Check boxes to select the particular <td>'s and display all selected <td>'s on another page.Then use following code to print.

<input type="button" value="Print This Page" onClick="window.print()" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.