skip to Main Content

My table gets populated from my phpmyadmin database in php:

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>";
}

And is in the HTML as so:

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

I want to make the last th (the email address) clickable, opening a sendto for the user to email the address. How is this achievable?

2

Answers


  1. Assuming the email is $row2[6], you would want to replace it with

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

    This will change it to a link with the email address still visible in the table.

    Login or Signup to reply.
  2. You can use anchor tag mailto to clickable like the following

    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><a href='mailto:".$row2[6]."'>$row2[6]</a></th>
            </tr>";
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search