PHP resides on the server, so you cant use PHP to initiate a print command directly, only to output something to the browser, the browser uses JS to start an automatic print. Why cant you use the javascript command ??
That’s correct. PHP does things only to the server, and then sends output to the user. The only way I can think of to make that output make the browser print is using the Javascript function. Here’s a code sample plucked off the Internet:
<form>
<input type="button" value="Print this page" onClick="window.print()">
</form>
You could always check if javascript is turned off, if so just dont show the print button, this saves people hitting buttons that apparently, to them, dont work.