Hi! am new in php, and i want my web application to be able to print the
data displayed on my web page by pressing on the print button.

Recommended Answers

All 6 Replies

No, its not urgent to me, no amount of capitals makes it urgent :grin:

dont try to remake the wheel, most users already know where the print button is on their browser
create a print stylesheet that makes the onscreen version, which is one shape, look better on paper, which is a different shape

@media print { /* typeface margins columns images laid out to suit paper */ }
@media screen { /* what you already have */ }

It is also stated in the forum rules as well :)

commented: sorry! i didn't read the forum rules before +0

As far as I am aware, it wouldn't be possible to do this in PHP as PHP is rendered server side. This means that once it is sent to the client's browser, there is nothing left of it.

At most you could echo out a JavaScript function/button combination to do it.

@AHarrisGsy, i thought it is possible to do this with php, just would be more complicated? but yes, javascript is a better choice.

Thank you all for your help! i'll try with Javascript and let you know if it works.

Be a part of the DaniWeb community

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