Jump to content

Printing In PHP


glenelkins

Recommended Posts

Hi

Never actually had to do this before. I have setup a script to send an email out containing some information. as such

[code]
$body = "<body bgcolor='#23972C'><font face='Verdana' size='2' color='white'>";
$body .= "Hello " . $name . ",<br><br>";
$body .= "Following is the information on one of our properties you requested.<br><br>";
$body .= "Kind Regards<br>";
$body .= "Connaught Estates<br><a href='http://www.connaughtestates.com'>http://www.connaughtestates.com</a><br><hr width = '50%' color='white' align='left' height='1px'><br><b>" . $title . "</b><br>";
$body .= $image . "<br><b>£" . $price . " " . $type . "<font color='black'> " . $status . "</font>";
$body .= "<br><br>Address: </b>" . $address . "<br><b>Area: </b>" . $area;
$body .= "<br><br><b>Rental/Purchase: </b>" . $rentalorpurchase;

if ($rentalperiod != "") {
$body .= "<br><b>Rental Period: </b>" . $rentalperiod;
}

$body .= "<br><b>Bedrooms: </b>" . $bedrooms . "<br><b>Bathrooms: </b>" . $bathrooms;
$body .= "<br><br>" . $fulldescription;
$body .= "</font></body>";
[/code]

How would i get PHP to actually print this (to  a printer) so that it prints the information and not the code itself?
Link to comment
Share on other sites

you can't - the only thing you coudl do is use the javascript window.print(); command on the onload event of the body. This would need the users email agent to support js. Same could be done on a normal web page - BUT I would be very annoyed at something trying to print automatically without my input. I don't want to see warnings that I have tried to print when my printer is off - or that I have been charged 5p for printing something I didn't request when I am using a cluster and have to pay for printing....

I just don't want anything to print out automatically - I want control and that is teh case for the vast majority of users on the web.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.