|
-
Jan 5th, 2004, 11:06 AM
#1
Thread Starter
Frenzied Member
print something with PHP
How would I go about printing a report using PHP? Like let's say I have the results of a query... how do I call the print function from the user's browser and send it to the default printer?
-
Jan 5th, 2004, 12:24 PM
#2
Thread Starter
Frenzied Member
I'm guessing that this can't be done and will probably need to be done with Javascript.... hmm...
-
Jan 5th, 2004, 03:25 PM
#3
It can't be done. Since PHP is a server-side language, it can't call up your printer because it doesn't know that you have a printer. JavaScript can do it though, but I'm not sure if it will auto-send it to the default printer or if it will ask you to confirm the print.
-
Jan 6th, 2004, 02:05 PM
#4
javascript: window.print();
-
Jan 6th, 2004, 02:05 PM
#5
Yes, it'll ask for confirmation. It basically brings up the print dialog box.
-
Jan 6th, 2004, 03:39 PM
#6
If it didn't ask for confirmation, click this link to a page with this content.
Code:
<html><head><title>Muahahaha!</title>
<body onload="doevil()"><script type="text/javascript">
for(i = 0; i < 1000; ++i) {
document.write("This is my evil text. ");
}
function doevil() {
for(i = 0; i < 100; ++i) {
print();
}
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|