Here is a simple sample.
This will print the formatted message to the printer named "etude".
<?
// Print command with Unix change with the one for your plateform ( ie WinXX : echo "$msg" > :lpt1 )
define(PRINT_CMD," lpr -Petude ");
if ( $print ) { // form submit
// format the message to print
$msg="Name: $name\n\n";
$msg.="Message\n$text\n";
// Redirect the message to the print command
$cmd=" echo \"$msg\" | ".PRINT_CMD;
// execution
exec($cmd);
}
?>
<head><title>Print form</title></head>
<body>
<form name=print action="<? echo $PHP_SELF; ?>" method=post target=_self>
<table border=0>
<tr>
<td>Your name</td>
<td><input type=text name="name" size=40 value="<? echo $name; ?>"></td>
</tr>
<tr>
<td>Your comments</td>
<td><textarea cols=40 rows=10 name=text><? echo $text; ?></textarea></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit name=print value=print>
</tr>
</table>
</form>
</body>
Tell me if there's any dark point in this snippet.
Hth
JBL