/    Sign up×
Community /Pin to ProfileBookmark

Printing a PHP Page

Can anyone help with this problem???


————————————————————————–

On a PHP Page there is a print button/link.
I want to print this page without printing the print button/link.
Also, after printing the page another page should open.
Can this be done? And how?


————————————————————————–

Thanx all.
?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@sridhar_423Jan 20.2006 — <input type=button name=btn id=btn1 value="print" onclick="printDis()">

function printDis(){

document.getElementById("btn1").style.visibility="hidden";

window.print();

//document.getElementById("btn1").style.visibility="visible";

window.open("another.html","_self","toolbar=1");

}
Copy linkTweet thisAlerts:
@acorbelliJan 20.2006 — By the way, that printing is a JavaScript function. Not the ability of PHP.
Copy linkTweet thisAlerts:
@php_dudetteauthorJan 21.2006 — Thankx a lot
Copy linkTweet thisAlerts:
@felgallJan 21.2006 — Don't use Javascript to perform a simple stylesheet function.

&lt;style&gt;
@media print {
#btn1 {display:none;}
}
&lt;/style&gt;
&lt;form&gt;&lt;input type="button" value=" Print this page " id="btn1"
onclick="window.print();return false;" /&gt;&lt;/form&gt;
Copy linkTweet thisAlerts:
@php_dudetteauthorJan 23.2006 — Therez one problem with this solution.

On some system it works and on some the same script does not.

Any solution to this? Can i use any other script language to do the same?
Copy linkTweet thisAlerts:
@HuevoosJan 24.2006 — Don't use Javascript to perform a simple stylesheet function.
[/QUOTE]

That should work great, but I would change the id=btn1 for a class=btn1 it's likely that you'd want another thing to be invisible, here is the code
&lt;style&gt;
@media print {
.btn1 {display:none;}
}
&lt;/style&gt;
&lt;form&gt;&lt;input type="button" value=" Print this page " class="btn1"
onclick="window.print();return false;" /&gt;&lt;/form&gt;
×

Success!

Help @php_dudette spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...