cjbeck71081 Posted January 12, 2007 Share Posted January 12, 2007 I have a PHP mailer i would like to pass variables through the body of an HTML template text document. Currently i only have the body of the HTML document copy and pasted into the body of the PHP MailerSo in other words a user fills out a form, the variables are posted into PHP Mailer form where the body section is filled out using an HTML template.here is my code[code]<?phprequire("class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP(); // telling the class to use SMTP$mail->Host = "mail.epicri.com"; // SMTP server$mail->From = "chris@epicri.com";$mail->AddAddress("paul@pmitconsulting.com");$dol="$";$date = date("l jS F Y, ");$gim = date('g');$fix = $gim+7;$time = date(':i:s a');$qty1=$_POST['qty1'];$qty2=$_POST['qty2'];$qty3=$_POST['qty3'];$qty4=$_POST['qty4'];$qty5=$_POST['qty5'];$qty6=$_POST['qty6'];$qty7=$_POST['qty7'];$qty8=$_POST['qty8'];$qty9=$_POST['qty9'];$qty10=$_POST['qty10'];$qty11=$_POST['qty11'];$tot1=$_POST['tot1'];$tot2=$_POST['tot2'];$tot3=$_POST['tot3'];$tot4=$_POST['tot4'];$tot5=$_POST['tot5'];$tot6=$_POST['tot6'];$tot7=$_POST['tot7'];$tot8=$_POST['tot8'];$tot9=$_POST['tot9'];$tot10=$_POST['tot10'];$tot11=$_POST['tot11'];$gtotal=$_POST['gtotal'];$name=$_POST['name'];$num1=$_POST['num1'];$num2=$_POST['num2'];$num3=$_POST['num3'];$num4=$_POST['num4'];$fax1=$_POST['fax1'];$fax2=$_POST['fax2'];$fax3=$_POST['fax3'];$floor=$_POST['floor'];$costctr=$_POST['costctr'];$email=$_POST['email'];$auth=$_POST['auth'];$shipto=$_POST['shipto'];$inst=$_POST['inst'];$mail->IsHTML(true); $mail->Subject = "Supplies Order";$mail->Body = <<<HTML<style type="text/css"><!--.style5 {font-size: 14px}.style6 {font-size: 12px}.style16 {font-family: arial; font-weight: bold; }--></style><p><br /><font face="Arial" size="2">Date Submitted:$date $fix$time<br /> <font face="Arial" size="3"><b>DTCC Supplies Order Form</b></font></p><table width="379" border="1" cellpadding="0"> <tr> <td width="177" align="left" class="style6"><span class="style6"><font face="Arial">NAME:</font> </span></td> <td width="190" class="style6">$name</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">PHONE NUMBER</font></span></td> <td width="190" class="style6">($num1) $num2-$num3 Ext:$num4</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">FAX NUMBER:</font></span></td> <td width="190" class="style6">($fax1) $fax2-$fax3</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">FLOOR:</font></span></td> <td width="190" class="style6">$floor</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">COST CENTER:</font></span></td> <td width="190" class="style6">$costctr</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">EMAIL:</font></span></td> <td width="190" class="style6">$email</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">AUTHORIZED BY:</font></span></td> <td width="190" class="style6">$auth</td> </tr> <tr> <td width="177" class="style6"><span class="style6"><font face="Arial">SHIP TO:;</font></span></td> <td width="190" class="style6">$shipto</td> </tr> <tr> <td width="177" class="style6"><font face="Arial"> SPECIAL INSTRUCTIONS/<br /> COMMENTS:<br /> </font></td> <td width="190" class="style6">$inst</td> </tr></table><p> </p><table width="538" border="1" cellpadding="0"> <tr> <td class="style5"><div align="center" class="style16">Description</div></td> <td width="95" class="style5"><div align="center" class="style16">Part No. </div></td> <td width="47" class="style5"><div align="center" class="style16">Qty</div></td> <td width="72" class="style5"><div align="center" class="style16">Price</div></td> <td class="style5"><div align="center" class="style16">Total</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">IMAGING UNIT, LDC-600 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">63582010</font></div></td> <td class="style5"><div align="left" class="style6">$qty1</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$215.00 ea</font> </div></td> <td width="57" class="style5"><div align="left" class="style6">$dol$tot1</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER CART, LDC-700 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">37081011</font></div></td> <td class="style5"><div align="left" class="style6">$qty2</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$41.95 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot2</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">IMAGING UNIT LDC-700 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">68882020 </font></div></td> <td class="style5"><div align="left" class="style6">$qty3</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$345.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot3</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER CARD, LDC-850/870 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">37017011 </font></div></td> <td class="style5"><div align="left" class="style6">$qty4</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$41.95 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot4</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">IMAGING UNIT LDC-850/870 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">2AN82010 </font></div></td> <td class="style5"><div align="left" class="style6">$qty5</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$225.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot5</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">EJECTION TRAY, LDC-600 SERIES</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">63504133 </font></div></td> <td class="style5"><div align="left" class="style6">$qty6</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$24.95 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot6</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER KM-F650 </font></span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">TK-40</font></div></td> <td class="style5"><div align="left" class="style6">$qty7</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$185.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot7</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER KM-F1050 </font></span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">TK-45</font></div></td> <td class="style5"><div align="left" class="style6">$qty8</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$168.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot8</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER KM-F1060</font></span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">TD-47</font></div></td> <td class="style5"><div align="left" class="style6">$qty9</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$147.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot9</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER XEROX PHASER 4400 HY</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">113R000628</font> </div></td> <td class="style5"><div align="left" class="style6">$qty10</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$184.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot10</div></td> </tr> <tr> <td width="220" align="left" class="style5"><span class="style6"><font face="Arial">TONER XEROX PHASER 4500 HY</font> </span></td> <td width="95" align="left" class="style5"><div align="left" class="style6"><font face="Arial">113R000657</font> </div></td> <td class="style5"><div align="left" class="style6">$qty11</div></td> <td width="72" align="left" class="style5"><div align="left" class="style6"><font face="Arial">$230.00 ea</font> </div></td> <td class="style5"><div align="left" class="style6">$dol$tot11</div></td> </tr> <tr> <td colspan="3" class="style6"> </td> <td align="left" class="style5"><div align="right" class="style6"><b><font face="Times New Roman">Total Order:</font></b> </div></td> <td class="style6">$dol$gtotal</td> </tr></table>HTML;$mail->WordWrap = 50;if(!$mail->Send()){ echo "Message was not sent"; echo "Mailer Error: " . $mail->ErrorInfo;}else{ header( 'Location: thanks.htm' ) ;}?> [/code]Thanks in advance Quote Link to comment Share on other sites More sharing options...
djbuddhi Posted June 9, 2008 Share Posted June 9, 2008 cant this table create dynamically.i need a code like this Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.