Print window (HTML/PHP)
Discussion
Right, my PHP/MySQL thingumy does most of what I want it to in terms of storing/updating info etc. Now I have to think about getting it to spit bits of paper out.
I want a button that users click and it spits the paper out with the minumum of user interaction.
I'm assuming I want to use a bit of javascript that is attached to an "on open" type event, but what?
Ideally as soon as the print document opens in a new window, I want it to print and then close itself. It's only ever a single page of A4.
What's the best method of achieving this?
NB: It will be a PHP document as it pulls information for a job sheet from the underlying MySQL.
Edit:
Is it really this simple?
script language="JavaScript"
window.print();
/script
So how do I close the window?
>> Edited by BliarOut on Thursday 20th October 13:27
I want a button that users click and it spits the paper out with the minumum of user interaction.
I'm assuming I want to use a bit of javascript that is attached to an "on open" type event, but what?
Ideally as soon as the print document opens in a new window, I want it to print and then close itself. It's only ever a single page of A4.
What's the best method of achieving this?
NB: It will be a PHP document as it pulls information for a job sheet from the underlying MySQL.
Edit:
Is it really this simple?
script language="JavaScript"
window.print();
/script
So how do I close the window?
>> Edited by BliarOut on Thursday 20th October 13:27
BliarOut said:
_dobbo_ said:
It was me, I posted totally the wrong answer then deleted it to avoid embarassment...... glad you got it sorted.
I nicked the bits that were right![]()
What was that dontPrint thingumy, that looks handy. Is it a standard property or a function?
I stole the code straight off another website and made it work on mine - the class thing must have been out of the css for that site - no idea what it does though...
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



Anyway, sorted, I thought it would be more difficult

