Results 1 to 6 of 6

Thread: print something with PHP

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    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?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I'm guessing that this can't be done and will probably need to be done with Javascript.... hmm...
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    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.
    Like Archer? Check out some Sterling Archer quotes.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    javascript: window.print();

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Yes, it'll ask for confirmation. It basically brings up the print dialog box.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width