i want a print button to be able to print out details of a php form by connecting to a printer.
can someone explain this to me with an example code please?

Recommended Answers

All 3 Replies

Rukshilag,

Just call window.print() from javascript, eg.:

<input type="button" value="Print" onclick="window.print();">
or
<button onclick="window.print();">Print</button>

With CSS @media rules, you can control the print format to be different from the screen format. For example, you can suppress background images and navigation bars or choose a completely different color scheme.

Airshow

yeah i used that.. but the entire form field names and so on get displayed. that is not what i want. i want it to print only what is entered to those fields.
example
form=edit
name - rukshila
age-22
school-ucsc

when print button is clicked what shud be printed is -
rukshila
22
ucsc

get what im saying?

get what im saying?

Yes I do. That's why I mentioned CSS @meida rules and provided a clickable link.

I suggest you do some background reading.

Airshow

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.