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.

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()">

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..

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.

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.