Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print function for PHP? 1

Status
Not open for further replies.

jisoo22

Programmer
Apr 30, 2001
277
US
Hello all,

Does anyone know if there is a print function for PHP? I'm trying to put a print button on my PHP page so clients can print the entire page from their own computers. I know javascript has such a thing but haven't seen any for PHP.

Thanks,
Jisoo22
 
sleipnir214 is right. You have to use clientsided javascript. And it is easy.

Step 1. Add this code between <head> tags on page You want to be printed:

<script language=&quot;Javascript&quot;>
<!-- Begin
function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}
function closeW(){
window.close();
}
// End -->
</script>

Step 2. Use hyperlink for printing on page you want to be printed like this:

<a href=&quot;&quot; onClick=&quot;javascript: printWindow(); return false;&quot;>Print</a>

This will solve your problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top