Jump to content

Print


dizzy1

Recommended Posts

Hi all i want to do is print another page

 

Im on one page click a button which passes variables accross:

 

<a href="PersonReportPrint.php?PersonID=1&Module=<?=$ModuleNo;?>&Tyear=<?=$Tyear;?>">

 

 

On the other page i have <body onLoad="window.print()">

 

which opens the print dialogue BUT it also opens that page PersonReportPrint.php when all i want is for that page to print.

Link to comment
https://forums.phpfreaks.com/topic/146028-print/
Share on other sites

You could try onLoad='window.print();window.close();' but for that to work the window would have to have been opened by a script in the first place (in firefox at least, not sure about ie), so you'd have to use something like <a onclick='window.open(your url)'> rather than <a href=...>

 

I'd find that behaviour fairly annoying if I was using it though...

Link to comment
https://forums.phpfreaks.com/topic/146028-print/#findComment-767042
Share on other sites

You could try onLoad='window.print();window.close();' but for that to work the window would have to have been opened by a script in the first place (in firefox at least, not sure about ie), so you'd have to use something like <a onclick='window.open(your url)'> rather than <a href=...>

 

I'd find that behaviour fairly annoying if I was using it though...

 

Ill try it see how annoyin it is, thanks.

Link to comment
https://forums.phpfreaks.com/topic/146028-print/#findComment-767189
Share on other sites

right ive added teh code so it opens in it own small window BUT when i do this

 

echo"<body onLoad='window.print()window.close();'>"; 

 

It Does Nothing If i Do this

 

echo"<body onLoad='window.print()'>"; 

 

IT PRINTS OR

 

echo"<body onLoad='window.close();'>";

 

IT Closed the window straight away.

Link to comment
https://forums.phpfreaks.com/topic/146028-print/#findComment-767206
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.