【发布时间】:2018-09-07 13:41:40
【问题描述】:
这是我现在使用的代码,效果很好。
<?php
if(!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
};
$from = "someone@there.com";
$to = "someone@here.com";
$subject = "Customer Order";
$message = "{$_POST['name']}
{$_POST['message']}
{$_POST['item1']} -Item 1
{$_POST['item2']} -Item 2";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
header('Location: thank-you1.html');
?>
当我收到发送的电子邮件时,无论输入了“item1”还是“item2”的数量,电子邮件都会显示 -项目 1 -项目2
如何排列这些标签,以便它们仅在该数量框有值时出现。
【问题讨论】:
标签: php email post message identify