-2

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 when I do it, the column is blank, but when I inspect it in the browser it shows up in the inspect panel.

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:

What the browser shows

On inspection:

On inspection

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Mwikala Kangwa
  • 430
  • 7
  • 24
  • Please stop using blockquote for text. I edited 2-3 of your other posts. This matter has been discussed on meta. Repeating actions like this, are flaggable for moderation. – Funk Forty Niner Feb 17 '18 at 13:56
  • So I ended up editing this one also; you could have done that, really. – Funk Forty Niner Feb 17 '18 at 14:03
  • sorry I'd seen a few people do the same so I didn't think it was a big deal – Mwikala Kangwa Feb 17 '18 at 14:07
  • well, they eventually get caught. If someone threw themselves off a beautiful bridge, would you jump also? ...... I didn't think so; least I hope not ;-) and it is a big deal, it's not meant for text, it's meant to either highlight an error, or to quote something from a manual or other site where information gets pulled from. – Funk Forty Niner Feb 17 '18 at 14:09

2 Answers2

4

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>";
Syscall
  • 19,327
  • 10
  • 37
  • 52
1
echo "<td>"."<a href='mailto:".$row['Submitted_By']."'>".$row['Submitted_By']."</a>"."</td>";

this line should be exactly like this.

T.Arslan
  • 123
  • 8