springer- Posted January 19, 2009 Share Posted January 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/ Share on other sites More sharing options...
DeanWhitehouse Posted January 19, 2009 Share Posted January 19, 2009 echo "<td width=15% ".$user_bg."><a class=\"nobr\" name=\"".$row['userid']."\" href=\"mailto:".$row['email_or_similar']."\">".$row['name']."</a></td>"; Try that Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/#findComment-740653 Share on other sites More sharing options...
revraz Posted January 19, 2009 Share Posted January 19, 2009 So why not just try the new line you created and see what happens? Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/#findComment-740657 Share on other sites More sharing options...
DeanWhitehouse Posted January 19, 2009 Share Posted January 19, 2009 I was thinking that,lol Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/#findComment-740665 Share on other sites More sharing options...
springer- Posted January 19, 2009 Author Share Posted January 19, 2009 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 !!!! Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/#findComment-740673 Share on other sites More sharing options...
springer- Posted January 19, 2009 Author Share Posted January 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/141490-solved-trying-to-add-email-link-to-field-result/#findComment-740677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.