Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Form to Printer with Submit Button

Status
Not open for further replies.

treyball3

Programmer
Jun 20, 2001
74
US
I have created a form using CGI/perl. When the user clicks the submit button, it returns the info they entered along with some additional areas for text to be written in. The problem is, I want the page to automatically print when the user clicks the submit button, instead of the output being in an html page and then the user having to select print. Does anybody know if this is even possible and if so, how do I do it. Any help would be greatly appreciated.
Todd
 
Well I am not sure if you can print the data within the text boxes, but you can use javascript.

For example, when the user clicks the button, on the new page that shows up, in the <body> tag, put a document.print().

But I don't think that you can print values in a form.

Check the JavaScript forum.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
Don't you lay out the form as plain text?
e.g.:

<body document.print>

Name: Joe Bloggs
Age: 67
Location: South West Mongolia
Intrests: Pizzas

</body>

if this is the case, yes thats the way to do it. As far as i know theres no cgi command to do it.

if your needing to print the current context of the form fields that might require more investigation.. perhaps a document.writeln() triggered on the loading of the page?

hope this helps
Sib
Siberdude
siberdude@settlers.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top