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.

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

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.

Archived

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

×
×
  • 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.