简体   繁体   中英

Mailto: inside php and html table

I'm populating an html table with data from MySQL DB and I want to add a mailto function on the click of one of the columns. Problem is

My Code:

while ($row = mysqli_fetch_assoc($result)) {
                echo "<tr>";
                echo "<td>".$row['Property_ID']."</td>";
                echo "<td>".$row['House_Number']."</td>";
                echo "<td>".$row['Street_Address']."</td>";
                echo "<td>".$row['Postal_Code']."</td>";
                echo "<td>".$row['City']."</td>";
                echo "<td>"."<a href='mailto:".$row['Submitted_By']."'></a>"."</td>";
                echo "<td>".$row['Date_Submitted']."</td>";
                echo "</tr>";

What the browser shows:

浏览器显示的内容

On inspection:

检查时

You <a> tag is empty, that's why you don't see your link.

You have to add your text inside <a> and </a> :

echo "<td>"
   . "<a href='mailto:".$row['Submitted_By']."'>".$row['Submitted_By']."</a>"
   . "</td>";
echo "<td>"."<a href='mailto:".$row['Submitted_By']."'>".$row['Submitted_By']."</a>"."</td>";

这条线应该是这样的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM