首页 > 解决方案 > 使表格中的电子邮件地址可点击,打开发送电子邮件

问题描述

我的表是从 php 中的 phpmyadmin 数据库填充的:

while($row2 = mysqli_fetch_array($result2))
{
    $dataRow2 = $dataRow2."
        <tr>
            <th>Event Name</th>
            <th>$row2[1]</th>
            <th>Location</th>
            <th>$row2[2]</th>
            <th>Description</th>
            <th>$row2[3]</th>
            <th>Date</th>
            <th>$row2[4]</th>
            <th>Cost</th>
            <th>$row2[5]</th>
            <th>Email</th>
            <th>$row2[6]</th>
        </tr>";
}

并且在 HTML 中是这样的:

<table>
<?php echo $dataRow2;?>
</table>

我想让最后一个(电子邮件地址)可点击,打开一个 sendto 让用户通过电子邮件发送地址。这是如何实现的?

标签: phphtml

解决方案


假设电子邮件是$row2[6],您希望将其替换为

<th><a href=\"mailto:$row2[6]\">$row2[6]</a></th>

这会将其更改为电子邮件地址在表格中仍然可见的链接。


推荐阅读