如何在 html 中将电子邮件地址设置为 mailto
How to set an email address to mailto in html
这是我的代码:
<table>
<tr><th>Enquiry ID</th><th>First Name</th><th>Last Name</th><th>Email</th><th>Phone</th><th>Date</th><th>Message</th><th align="center">Respond</th></tr>
<?php
require_once('includes/dbh.inc.php');
$sql = mysqli_query($conn, "select * from enquiries");
while ($row = mysqli_fetch_array($sql, MYSQLI_ASSOC)) {
echo '<tr><td>'.$row["enquiry_id"].'</td>';
echo '<td>'.$row["author_f_name"].'</td>';
echo '<td>'.$row["author_l_name"].'</td>';
echo '<td>'.$row["author_email"].'</td>';
echo '<td>'.$row["author_phone"].'</td>';
echo '<td>'.$row["post_date"].'</td>';
echo '<td>'.$row["message"].'</td>';
echo '<td><a href="mailto:"><p style="color:red";>Reply</p></a></td></tr>';
}
?>
</table>
我正在从数据库table中获取数据到table,查询。如果用户点击回复link我想根据enquiry_id附近的mailto获取邮箱地址:
怎么做?
谁帮帮我,谢谢!
您只需更改以下行:
echo '<td><a href="mailto:"><p style="color:red";>Reply</p></a></td></tr>';
至:
echo "<td><a href=\"mailto:{$row['author_email']}\"><p style=\"color:red;\">Reply</p></a></td></tr>";
这是我的代码:
<table>
<tr><th>Enquiry ID</th><th>First Name</th><th>Last Name</th><th>Email</th><th>Phone</th><th>Date</th><th>Message</th><th align="center">Respond</th></tr>
<?php
require_once('includes/dbh.inc.php');
$sql = mysqli_query($conn, "select * from enquiries");
while ($row = mysqli_fetch_array($sql, MYSQLI_ASSOC)) {
echo '<tr><td>'.$row["enquiry_id"].'</td>';
echo '<td>'.$row["author_f_name"].'</td>';
echo '<td>'.$row["author_l_name"].'</td>';
echo '<td>'.$row["author_email"].'</td>';
echo '<td>'.$row["author_phone"].'</td>';
echo '<td>'.$row["post_date"].'</td>';
echo '<td>'.$row["message"].'</td>';
echo '<td><a href="mailto:"><p style="color:red";>Reply</p></a></td></tr>';
}
?>
</table>
我正在从数据库table中获取数据到table,查询。如果用户点击回复link我想根据enquiry_id附近的mailto获取邮箱地址: 怎么做? 谁帮帮我,谢谢!
您只需更改以下行:
echo '<td><a href="mailto:"><p style="color:red";>Reply</p></a></td></tr>';
至:
echo "<td><a href=\"mailto:{$row['author_email']}\"><p style=\"color:red;\">Reply</p></a></td></tr>";