我正在通过一个基本的 HTML 表单收集信息。一些字段是[]
在其名称后标出的数组。
我已成功写入 MySQL 数据库,现在正尝试将数组值放入 PHP 生成的电子邮件中。电子邮件已成功发送并打印了一些变量,但没有一个数组值通过。我该怎么做?
$name
,$position
并且$email
是我遇到问题的值:
<?php
$to = "myemail@email.com";
$subject = "Media Request";
$message = "A media credential request has been submitted for $outlet. The editor is $editor and their contact info is $Eemail and $phone.";
$message .= '<html><body>';
$message .= "<h2>Credential Request</h2>";
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr><td align=right><strong>Name:</strong> </td>
<td>" . strip_tags("$name") . "</td>
<td align=right><strong>Position:</strong> </td>
<td>" . strip_tags("$position") . "</td>
<td align=right><strong>Email:</strong> </td>
<td>" . strip_tags("$email") . "</td></tr>";
$message .= "</table>";
$message .= ("Here are the comments and special instructions: $notes ");
$from = "email@email.com";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to,$subject,$message,$headers);
?>