Jump to content

[SOLVED] Trying to add email link to field result


springer-

Recommended Posts

The current PHP script looks up the userid and returns the name field.  I would like to modify the code so it will return the name field and display it as a link to that users email address.

 

I believe this is the line of code that preforms the above mentioned task.

 

echo "<TD WIDTH=15% $user_bg><A class=\"nobr\" name=\"".$row['userid']."\">".$row['name']."</A></TD>";

 

This is the best way I know how to show what I think I am trying to accomplish.

 

<a href="mailto:$row['userid']@domain.com">$row['name']</a>

 

The new line would be some combination of the 2 but I am not sure how to get it to display what I am looking for.

 

Example of current results

John Smith

 

Example of new results

John Smith

 

Thanks for any help you can offer.

Link to comment
Share on other sites

echo "<td width=15% ".$user_bg."><a class=\"nobr\" name=\"".$row['userid']."\" href=\"mailto:".$row['email_or_similar']."\">".$row['name']."</a></td>";

Try that

 

I modified the above with the following...

echo "<td width=15% ".$user_bg."><a class=\"nobr\" name=\"".$row['userid']."\" href=\"mailto:".$row['userid']."@domain.com"."\">".$row['name']."</a></td>";

 

And it seems to be working ... THANKS !!!!

Link to comment
Share on other sites

So why not just try the new line you created and see what happens?

 

I tried about 20 variations of the line but kept getting script errors.  I don't know PHP at all and not good at coding in general.  The syntax was not something I was getting with my guesses.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.