Jump to content

Archived

This topic is now archived and is closed to further replies.

gk20

Display name as an email link

Recommended Posts

I'm outputting a user's name and contact email address
eg. Username: adminiistrator
Email: example@domain.com

Instead I would prefer to just have the user's username as a link to their email?
How is this possible?
Or perhaps as a link so that a popup will appear with users email and phone number??

I tried the link something like this -
<a href="mailto:$email">$user</a>
where $email is the result of a query - $email = $row['Email'] and
$user is similar - $user = $row['username'];

Ideally id like to see both options above to see which one looks best, but if i could get help
with either that would be great?
Thanks!!!!!

Share this post


Link to post
Share on other sites
use
echo("<a href=\"mailto:$email\">$user</a>");

That should work as long as the values are set correctly :)

Share this post


Link to post
Share on other sites
Or you could use:
[code]<?php
echo '<a href="mailto:' . $email . '">' . $user . '</a>';
/>[/code]

Which does the same thing, but is easier to read

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.