0

i have two submit buttons in one form.
one is view and other is print.
these two buttons has only one action in the form.
both of them will go to another same page.

but,how can i make it when i click view, the next page will be shown,
when i click print, how can i print the next page
without showing that next page???
i mean when i click a 'PRINT' button from the current page,
the next page will automatically print without showing it.

i need this because, the next page is confidential
so when i click the print button, i can't see the next page.
the contents of the next page will be based on the query from
the database.


im using php, mysql..
tnx.

Edited by newbie26: n/a

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by broj1
0

Use Javascript for printing. The view button type attribute should be 'submit' while the print button type attributeshould be just 'button'. Then asign a javascript function to the print button like this:

<input type="button" onClick="window.print()">
0

Use Javascript for printing. The view button type attribute should be 'submit' while the print button type attributeshould be just 'button'. Then asign a javascript function to the print button like this:

<input type="button" onClick="window.print()">

hey...tnx for the reply..i tried it.
but the current page was the one printed not the next page.
:(
is there any other way????
tnx again..

0

Sorry, I have just noticed that you said that you want to print the other page. I guess that if you want to print form the browser using javascript that page has to be open in a window. So one optin is to open the other page in a new window and launch javascript function for printing form onload event. Maybe these discussions give you some hints:

http://www.webmasterworld.com/javascript/3524974.htm
http://www.highdots.com/forums/javascript/printing-another-web-file-present-274201.html

Another option would be to generate pdf (or doc) on the fly from the html of the other page and let user print the pdf which is much better for printing than hrml. I use TCPDF library for that and it works like a charm once you get used to it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.