命令在没有提示的情况下用php打印页面


command to print a page in php without prompt

我使用php、html和javascript中的以下代码打印一个html页面并重定向到另一个页面。它会显示一个提示。我需要在不显示打印提示/屏幕的情况下打印该页面,并自动重定向到新的php页面。

     <input type="button" value="Print & Do New Transaction" class="button" id="payout_print"  onclick="window.print();window.location.href='transaction/admin/new_transaction'">

我瞪大了眼睛,但没有得到任何有用的答案,我正在寻找。如何做到这一点?

对于需要重定向的页面:

<?
header("Location: destination_page.php");
exit;
?>

请记住,在此代码之前不要打印任何html代码,因为您会收到错误