Jump to content


Photo

Printing In PHP


  • Please log in to reply
2 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 29 September 2006 - 02:54 PM

Hi

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

$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>";

How would i get PHP to actually print this (to  a printer) so that it prints the information and not the code itself?
http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 29 September 2006 - 03:22 PM

-
http://thewebsolutionprovider.com - A Solution For Everything Web!

#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 29 September 2006 - 04:08 PM

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.


follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users