I would like to know if it is possible for someone to fill a form on my website, but instead of sending it to a email or database, simply print it?

Because we can't handle credit cards here, and I want people to fill in the form, print it, and give it to us with the cash...

Is that possible?

7 Years
Discussion Span
Last Post by riseguim

Just an idea: if you don't need to store those information and your website is not using an SSL Certificate, then it's better to use javascript, so the users can fill the form, display and print it without sending anything to the server.


use javascript

<input type="button" value="Print this page" onClick="window.print()">

Why not use Print button on the browser or keyboard?

the number of helpdesk req there are for 'how do I print this'
If you program a print button right in the middle of the page there is less chance of somebody assuming you CAN'T print because there is no print button
unfortunately not 'no chance' just less chance

without a button you almost have to put detailed instructions on the page how to access 'print'


use javascript

<input type="button" value="Print this page" onClick="window.print()">

Thanks for the code, but is there a way to only print the form and not the entire page?



@media print { .dontprint { display:none;}
@media screen { .dontshow { display:none; }
<div class='menu dontprint'> this represents the onscreen menu, which you dont want to print</div>
<div class='dontprint'>This is onscreen instructions for the form</div>
<div class='dontshow'>this is different on-paper instructions for the form</div>
<form>bla bla bla this is the form
What is your choice <select class='dontprint' onchange='self.className="";'>
</select><input type='text' class='dontshow'>
<!-- this creates a select box onscreen, but a fill in textbox on paper unless the user has set the value of the select box -->
<div class='dontprint'> this is anything else you dont want to print</div>
<div class='dontshow'> this is anything else you want to print but dont want to show onscreen</div>
<div class='dontshow dontprint'> this is spambot killer 
<a rel='nofollow'  href='http://www.auditmypc.com/freescan/antispam.html'>I hate spambots</a>
well behaved bots don't follow the link</div>

Edited by almostbob: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.