How can I print information in a form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dilbert137
Forum Commoner
Posts: 57
Joined: Sat Jun 02, 2007 5:02 am
Location: Mauritius

How can I print information in a form

Post by Dilbert137 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Dear All,

I have written a form statement with order data but need these information to be printed. Can someone tell me if it is possible to print form data in the same format.

[syntax="html"]<form name='frm_user'  action="<?php echo $_SERVER['PHP_SELF']; ?>" method='post'>
	<table width='100%' border='1' cellpadding='1' cellspacing='2'>
		<tr>
		    <td align="right" bgcolor="#D8C56F"><b>Order No.:</b></td>
		    <td align="left"><input type="text" name="txt_orderid" size="20" value="<?php echo $result['Num_Cmde']; ?>" READONLY></td>
	            <td>&nbsp;</td>
	  	   <td align="right"><input class="box" name="btnPrint" type="submit" id="btnPrint" value="Print"/></td>
		</tr>



Best Regards
Dilbert137


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You mean to the screen, or a printer?
Dilbert137
Forum Commoner
Posts: 57
Joined: Sat Jun 02, 2007 5:02 am
Location: Mauritius

Post by Dilbert137 »

To the printer.

Regards
Dilbert137
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

php is executed server-side and has no control over a client-side printer, if that is your question.
However, the user can of course print the html page and you can add a button like

Code: Select all

<button onlick="window.print()">print document</button>
for their convenience.
Dilbert137
Forum Commoner
Posts: 57
Joined: Sat Jun 02, 2007 5:02 am
Location: Mauritius

Post by Dilbert137 »

Thanks it's working. I have coded the script like that.

<input class="box" onclick="window.print()" name="btnPrint" type="button" id="btnPrint" value="Print"/>

Best Regards
Dilbert137
Post Reply