By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,145 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

how to open new (printer-friendly) window

P: n/a
Hi all

I have a php script that presents a rather simple form. After the user
filled in parameters and presses <submit>, the results from a postgres
database search follows on the page.

Now, if the user wishes to print the page, it'll be ugly containing
the form boxes. So one solution would be to present a
"printer-friendly" option on the page. Clicking there will present the
results in a new window free from the form boxes. I don't want to
repeat the database search in this new window, just "forward" the
variables to this new url.

I guess it could be done, but how?

Grateful for any help!
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Gandalf wrote:
Hi all

I have a php script that presents a rather simple form. After the user
filled in parameters and presses <submit>, the results from a postgres
database search follows on the page.

Now, if the user wishes to print the page, it'll be ugly containing
the form boxes. So one solution would be to present a
"printer-friendly" option on the page. Clicking there will present the
results in a new window free from the form boxes. I don't want to
repeat the database search in this new window, just "forward" the
variables to this new url.

I guess it could be done, but how?


Well, imho you should use CSS for this part...

Use "media" and include 2 stylesheets... one for the screen
(media="screen") and one for the print (media="print")

http://www.w3.org/TR/REC-CSS2/media.html

Regards,
johan

Jul 17 '05 #2

P: n/a
Gandalf wrote:

[snip]
Now, if the user wishes to print the page, it'll be ugly containing
the form boxes. So one solution would be to present a
"printer-friendly" option on the page. Clicking there will present the
results in a new window free from the form boxes. I don't want to
repeat the database search in this new window, just "forward" the
variables to this new url.


I guess the easiest solution to this problem would be to use an
alternative stylesheet which removes all the formatting. Linking this to
your document with the following statement would result in nice prints
with most browsers:

<link rel="stylesheet" type="text/css" href="print.css" media="print">

I know this isn't excactly the solution you asked for, but i recommend
you give it a thought.

--
Tormod Fjeldskår
to****@fritidsproblemer.no
http://tormod.fritidsproblemer.no/
Jul 17 '05 #3

P: n/a
Tormod Fjeldskår wrote:
Please check your date settings... or are you from the future? ;)

Regards,
Johan

Jul 17 '05 #4

P: n/a
Johan Holst Nielsen wrote:
Please check your date settings... or are you from the future? ;)


I'm terribly sorry! Did some time-related php-scripts and forgot to
return to the present ;)

--
Tormod Fjeldskår
to****@fritidsproblemer.no
http://tormod.fritidsproblemer.no/
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.