Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Print a form to Printer

Posted on 2007-11-20
3
Medium Priority
?
311 Views
Last Modified: 2008-02-01
Hi expert
I have a page, in this page i have some information and a form with name "forprint"
Now i want to print only this form "forprint" to my Printer

So how can i do with PHP ?
Thanks very much.
0
Comment
Question by:fuzzyifs
3 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 750 total points
ID: 20318822
you don't do this with PHP, you have to create a page just with the form, say printForm.html and then put ONLY the form on the page. Linke ti printForm.html to your normal form page, have a link something like "print form" which links to printForm.html. This way the visitors can print your form by pressing the Print to print out printForm.html.

Hope this helps. This is unrelated to PHP as PHP is a serverside language, and printing is clientside.
0
 
LVL 6

Assisted Solution

by:den4b
den4b earned 750 total points
ID: 20318827
In your PHP page, create a link like "page.php?printform=1" (as a popup perhaps).

Then, in the code, check if "printform" variable is set, then echo/output ONLY the form data (which you want to print), and execute javascript command "window.print()". After printing you can automatically close the window with "window.close()".
0
 

Author Comment

by:fuzzyifs
ID: 20318855
Thanks to all.
Thanks den4b, i will try with your solution
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question