Copy link to clipboard
Copied
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
<td>Email</td>
<td><?php echo "<a href='mailto:".$row_rsDetails['Email']."'>".$row_rsDetails['Email']."</a>"; ?></td>
Copy link to clipboard
Copied
<td>Email</td>
<td><?php echo "<a href='mailto:".$row_rsDetails['Email']."'>".$row_rsDetails['Email']."</a>"; ?></td>
Copy link to clipboard
Copied
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> Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Also, now i have it working i would like to change 2 things:-
1. Change the email address that people see to just "Email"
2. add a subject to the email when people click on the email link.
Is this possible?
Copy link to clipboard
Copied
<td>Email</td>
<td><?php echo "<a href='mailto:".$row_rsDetails['Email']."?subject=This is the subject'>EMAIL</a>"; ?></td>
Some people may want to make note of the email address without actually clicking the link, which is why I usually make the address visible.
Copy link to clipboard
Copied
Thank you, Thank you, Thank you. I have been working on this for days now going through books and the internet - you are brilliant.
Copy link to clipboard
Copied
You are welcome.
Your questions were really simple, so if you are going to continue to do such work, take the time to learn basic HTML/CSS and PHP. In probably two weeks you could lean enough to save yourself from many fustrations similar to the one you posted.
Copy link to clipboard
Copied
I want people to be able to click on the client's email address so that they can directly email the client
i would like to change 2 things:-
1. Change the email address that people see to just "Email"
2. meaningless request regarding the point of my following post
Rob:
Some people may want to make note of the email address without actually clicking the link, which is why I usually make the address visible.
Rob's recommendation is poor at best.
Robots still see the email address in source code and they will still harvest those addresses to spam your users. Also visitors will not be able to send mailto: link unless they have email setup on their client, which unaquainted web users have failed to setup. This means that a mailto: link will attempt to open up the users default mail application to send an email. This method is generally undesired, because as mentioned earlier, most web users fail to setup their local email application to send/recieve mail. Some web users still use web based mail to manage their emails. so what usually happens with those users is they click on the mailto: link, it opens their local email application that isn't setup, they become frustrated because they can not send an email, so they fail to send an email and they leave your site due to frustration. This is a result of the sloppy methods you used, recommended by others, in setting up a system to allow users to email your recipients. Technically the client has already left your site at this time because by clicking on the mailto: link they have opened their client side default email application, which loses focus of the clients browser application, thereby technically leaving your website.
The preferred method is to create a dynamic email form where visitors can complete a form on the website and submit the form in order to send an email (with dynamic subject included). This eleminates the need for the visitor to leave your site to send an email (by opening mail app on client side) and it also prevents the email addresses being exposed in source code to potential spammers. Your current method = 1990's/bad. Get with the times and consider the recommendation of creating a dynamic email form to protect your email addresses from spam and ensure that clients can send emails without leaving your site and opening up their client Mail application (which may not be setup).
If you want to make the email visible as Rob mentioned then use php to create a dynamic image to display the email address.
best,
Shocker
![]()
Copy link to clipboard
Copied
Hi
Thanks for that.
I have never created a dynamic email form - have you any idea of best way to start? Advice, websites, extensions etc?
Any advice would be greatefully received.
Copy link to clipboard
Copied
My advice is to do a google search for php mail. There are plenty of scripts available that you can use. Simply enter dynamic value for email address into the header of the mail() function. Use validation methods in email form to prevent undesired emails being sent and also to prevent email injection attacks. Honeypot, captcha, injection attacks, etc. Start searching! Or just use the amateur method (not brilliant) that was recommended earlier. Just be aware that the mailto: method recommended earlier is not efficient, will not work for all users, does not include any method for validating content, and you expose the published email addresses of being harvested by robot spammers. Good luck!
best,
Shocker ![]()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now