我試圖根據可用的變量進行電子郵件更改。PHP:嘗試發送帶有變量和IF語句的電子郵件表格
總共有6個操作ID,但是與其他操作不同,其中20個(代碼如下所示)需要機器代碼。
$email =
if ($OperationID == 20)
{
'Machine: '.$machCode."\r\n".
}
"JobID: ".$jobid."\r\n" .
"PartID: ".$part_id."\r\n" .
"\nNote: ".$message."\r\n";
@mail($email_to, $email_subject, $email);
如果「if
聲明」不存在的郵件可以發送看起來像下面
Machine:
JobID: 123456789
PartID: 123456789
Note: Test
我不希望這是有空格旁邊的「機器」。我想刪除的機器生產線,除非很明顯,OperationID
爲20。因此,電子郵件如下所示:
JobID: 123456789
PartID: 123456789
Note: Test
我怎麼會讓它所以該機行纔會被激活時,操作等於20?
我目前得到這個錯誤提前
`Parse error: syntax error, unexpected T_IF in /var/www/ps_t/send_form_email.php on line 21 Call Stack: 0.0004 656768 1. {main}() /var/www/ps_t/punch.php:0` with the code used above.
感謝。
感謝您的。這真的很簡單...... – Moms