私はこのsend_mail.phpファイルを持っています。私はフォームに挿入されたいくつかのフィールドをエコーしようとしていますが、エコー機能ではできません。私は間違って何をしていますか?入力データフィールドをfile_get_contents htmlテンプレートにエコーする方法はありますか?
<?php
$date = $_POST['date'];
$full_name = $_POST['full_name'];
$biz_name = $_POST['biz_name'];
$activity = $_POST['activity'];
$afm = $_POST['afm'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$city = $_POST['website'];
$email = $_POST['email'];
$discount = $_POST['discount'];
$payment_amount = $_POST['payment_amount'];
$seller_name = $_POST['seller_name'];
$to = $email;
$subject = "Welcome to our site!";
$htmlContent = file_get_contents("email_template.html");
// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = "Content-type: text/html; charset=UTF-8" . "\r\n";
// Send email
if(mail($to,$subject,$htmlContent,$headers)):
$successMsg = 'Mail sending successful.';
else:
$errorMsg = 'Oops! Something went wrong.';
endif;
?>
そして、私のemail_template.htmlは次のようになります。私はWeb開発に新たなんだ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome to our site</title>
<head/>
<body>
<h1> Welcome <?php echo $full_name; ?> </h1>
...
</body>
</html>
とても優しくして! :P
ありがとう!それはうまくいった! –