Hi all:
I am getting an error when I try to run a WHILE LOOP inside my PHPMAILER body. The error is:
Parse error: syntax error, unexpected T_WHILE in C:\Web\MySite\adm\admInvoices.php on line 335
Here is the Mail code. Any help appreciated!:
<?php
if ($POST["remail"]== "Y"){
if (isset($rInstructions)){
$vInstructions = "<div style='line-height: 20px; height:auto; background-color:#EFEFFF; padding-left:5px;'>" . $rInstructions . "</div><p>";
}
if ($rState == "CT"){
$vStateTax = "<tr><td style='width:80%; font-weight:bold;'>CT Sales Tax:</td><td style='width:20%; text-align:right;'>" . $rTax . "</td></tr>";
}
if (isset($rAdjustmentAmount)){
$vAdjustmentAmount = "<tr><td style='width:80%; font-weight:bold;'>" . $rAdjustment . "</td><td style='width:20%; text-align:right;'>"&F . $rAdjustmentAmount . "</td></tr>";
}
require_once( 'class.phpmailer.php' );
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
//$body = file_get_contents('../gvy/2232011.asp');
//$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$body = "
<div style='border:1px solid #CCC; margin:auto; width:700px; padding:10px; font-family:tahoma, sans-serif; font-size:14px;'>
<img border='0' src='http://www.signingshotline.com/img/shl/logo1.gif' width='201' height='70' alt='SHL' />
<br />
<span style='font-weight:bold;'>We list EVERY athlete autograph appearance in the United States and Canada!</span>
<p>
" . $rOrderDate . "<p>
Invoice Number: " . $rInvoice . "<p>
" . $rFirstName . " " . $rLastName . "<br />
" . $rCompnay . "<br />
" . $rAddress . "<br />
" . $rCity . ", " . $rState . "<br />
" . $rZip . ", " . $rCountry . "<p>
" . $rPaymentType . " " . $rLast4Digits . "<p>
" . $vInstructions . "
<table style='width:700px; font-size:14px;'>
<tr>
<td colspan='2' style='width:100%; line-height: 25px; font-weight: bold; height: 25px; background-color:#FFCC00; margin-left: auto; margin-top: 10px; padding-left: 5px;'>Order Information:</td>
</tr>"
. while (mysqli_stmt_fetch($stmtPrice)) {
$vTotalPrice = $rQuantity*$rPrice;
"<tr>
<td style='width:80%; text-align:left;'>" . $rQuantity . " " . $rProduct . ":</td>
<td style='width:20%; text-align:right;'>" . $vTotalPrice . "</td>
</tr>"
. } .
$vStateTax
$vAdjustmentAmount . "
<tr>
<td colspan='2'><hr style='width:98%;' /></td>
</tr>
<tr style='font-weight:bold; background-color:#EFEFFF'>
<td style='width:80%;'>Total:</td>
<td style='width:20%; text-align:right;'>" . $rGrossAmount . "</td>
</tr>
</table>
</div>
";
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = false; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "mail.mysite.com"; // SMTP server
$mail->From = "info@.mysite.com";
$mail->FromName = ".mysitecom";
$to = $rEmail;
$mail->AddAddress($to);
$mail->Subject = ".mysite.com Invoice: " . $rInvoice;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
}
//End email
?>