從html表單中將文本存儲在數據庫中。 用下面的代碼我試圖郵件文本到reciepant:php郵件功能內容佈局
$recipient = $emailadres;
$subject = 'xxxx';
$header = 'From: xxxx <[email protected]>';
if ($aanhef == 'Dhr.') {
$geslacht = 'heer';
}
elseif ($aanhef == 'Mevr.') {
$geslacht = 'mevrouw';
}
else {
$geslacht = 'heer/mevrouw';
}
$mail_body = $bevestiging;
$mail_body = str_replace('#geslacht#', $geslacht, $mail_body);
$mail_body = str_replace('#achternaam#', $achternaam, $mail_body);
mail($recipient, $subject, $mail_body, $header);
在變量mail_body郵件的內容存儲
,在內容,性別和姓氏被替換了。這個PHP代碼的作品。但是,如果我們查看收到的郵件,所有在HTML表單中填寫的輸入都變成了兩個輸入,換句話說,電子郵件的整個佈局發生了變化,當我查看數據庫時,正常佈局中的文本存在,沒有雙重進入等。但是如果我在數據庫中手動輸入文本,它就會正常工作。是否有可能在數據庫中存儲隱藏的html佈局?抑或是別的東西
在str_replace之前檢查email_body值/輸出之後... –
之前str替換佈局已經是錯誤的 – tortilla