code to print page in html code example
Example 1: print button code in php
<button onClick="window.print()">Print</button>
Example 2: how to code print in javascript
console.log("print")
//or
alert("Print")
<button onClick="window.print()">Print</button>
console.log("print")
//or
alert("Print")