0

I am currently using this code to display mysql records in a html table

<?php
while($row  =   mysqli_fetch_assoc($records)){
    echo "<tr>";
.
.
    echo '<td>   <a href =  "     mailto:  '. $row["Email1"] . '   "  >  '. $row["Email1"] . ' </a>   </td>';
.
.
    echo "</tr>";
}

?>

It works fine except that it opens the email on the same page and I need it in a new tab or new page. I have found out that I need to include target="_blank", but where to put the single/double quotes is giving me brain fade and I haven't got it working yet. Can someone show me a working example and is this the best approach?

Cheers.

Acoustic Jack
  • 107
  • 3
  • 14

1 Answers1

1

Using 'mailto:' activates the default mail client on the computer. Therefore if you have Apple Mail as your email client, clicking on the mailto link will open Apple Mail so you can send an email to that address specified in the link. I don't understand when you say you're trying to open it in a new tab.

Make sure to take out the spaces after 'mailto:'. Should read 'mailto:abc@xyz.com'.

Jen Mason
  • 144
  • 1
  • 12
  • I understand about the user's default mail client and when the code above is run in Firefox, my default mail client (GMail) opens with the address from the server as I would expect. The problem which I can't solve is that this all happens in the same browser window. All I need is the mail client to open a new browser window or tab. – Acoustic Jack Apr 30 '15 at 22:32
  • I'm not sure that is possible. I know in the past it wasn't, but don't know if that's been fixed. – Jen Mason May 04 '15 at 12:53