I've got a form that people can fill in, and if they press the 'submit' button, the form should be printed with the filled-in values instead of the input fields in the html(php) page.
To make things easier, a stylesheet for print might be used too.
How could I achieve such a thing?
Thanks in advance.
[edited by: Darkelve at 7:18 am (utc) on Oct. 3, 2006]
RonPK
9:49 am on Oct 3, 2006 (gmt 0)
PHP runs on the server and cannot launch a client side print job.
What you're after probably can be achieved with some javascript. If you already have a special stylesheet for print, simply calling
window.print()
should do the job...
Darkelve
6:44 am on Oct 5, 2006 (gmt 0)
Ok,
but then how do I replace the input fields with the values entered in?
Maybe it would be possible to first process the form with PHP (subsequent page so they could check all is correct) and then give the option to print?
RonPK
8:17 am on Oct 5, 2006 (gmt 0)
first process the form
Yeah, that may be the way to go. I don't think users should be encouraged to print a form until the entire process is finished. Otherwise they might think "OK, I've got this nice print, I'm ready.".