How to print a web page without the button being printed as well.

Profile blocked -  
Pitet Posted messages 2845 Status Member -
Hello,
I would like to thank all the forum members for their important help that they provide me every time I need it.
To all PHP programmers, I have a problem with printing my web pages because every time I print by clicking the print button with the function: <input type="submit" name="ok" value="Print" onClick="if(confirm('Do you want to print this form?')){ print();} else{return false;}">
I end up printing the content of the page along with the button; this is incompatible for me and it is even displeasing to the eye of the printout. I don't know what to do at the moment, which is why I really need your help to remedy this problem.

Thanks in advance to everyone.

Configuration: Windows 7 / Firefox 24.0

2 answers

  1. Pitet Posted messages 2845 Status Member 530
     
    Hello,

    You can define a specific CSS for printing your page. To do this, you need to link a stylesheet to your HTML page by specifying the attribute media="print":
    <head> ... <link rel="stylesheet" type="text/css" href="ma_feuille_css_imprimante.css" media="print" /> ... </head>


    For more details, you can consult this link:
    https://www.alsacreations.com/tuto/lire/586-feuille-style-css-print-impression.html
    0
    1. ThEBiShOp Posted messages 9307 Registration date   Status Contributor Last intervention   1 606
       
      Is there an echo? :)
      0
    2. Pitet Posted messages 2845 Status Member 530
       
      Indeed, I am slow to respond. Nevertheless, I see that we have the same sources of information ^^
      0