Jump to content


Photo

Display name as an email link


  • Please log in to reply
2 replies to this topic

#1 gk20

gk20
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 16 March 2006 - 04:40 PM

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!!!!!

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 16 March 2006 - 05:10 PM

use
echo("<a href=\"mailto:$email\">$user</a>");

That should work as long as the values are set correctly :)
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 16 March 2006 - 05:15 PM

Or you could use:
<?php
echo '<a href="mailto:' . $email . '">' . $user . '</a>';
/>

Which does the same thing, but is easier to read

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users