Skip to main content
Participating Frequently
December 17, 2011
Answered

how do i make an email field from my sql appear as a link

  • December 17, 2011
  • 1 reply
  • 1529 views

I have a page on my website that shows clients details.  the page retrieves all information about the client's details from a mysql database.  I want people to be able to click on the client's email address so that they can directly email the client and also be able to click on their URL and it will take them direct to the client's website.   I have a recordset set up to show the details of a particular client. I have set up the email details as follows:-

<td>Email</td>

        <td><?php echo $row_rsDetails['Email']; ?></td>

If someone could let me know how to turn this into a link so that it emails the client directly i would be really greatful.  (Also, how to do the same with a URL)

Thanks

This topic has been closed for replies.
Correct answer Rob Hecker2

<td>Email</td>
        <td><?php echo "<a href='mailto:".$row_rsDetails['Email']."'>".$row_rsDetails['Email']."</a>"; ?></td>

1 reply

Rob Hecker2
Rob Hecker2Correct answer
Legend
December 17, 2011

<td>Email</td>
        <td><?php echo "<a href='mailto:".$row_rsDetails['Email']."'>".$row_rsDetails['Email']."</a>"; ?></td>

Laura76Author
Participating Frequently
December 17, 2011

Thank you so much - that is perfect - can you tell me what i would need to change to link to a URL (I presume i need to remove the "mailto" but am not sure what to replace it with detail is currently:-

<td><?php echo $row_rsImage['WebAddress']; ?></td> 


Rob Hecker2
Legend
December 17, 2011

Well, following the same pattern, it would be like this:

<td>Email</td>

        <td><?php echo "<a href='http://".$row_rsImage['WebAddress']."'>".$row_rsImage['WebAddress']."</a>"; ?></td>