Send email with working url from contact form


#1

Hi,

Just signed up!

I have a well working contact form in which I have included the name of the sender and the url to his web page in the message body right above his message.

When I use this code:

$message_body .= "<span style='font-size: 12pt;'>URL: " . $_POST["url"] . "</span><br><br>";

The url is sent, but it doesn’t come through as a clickable link. One must select, right click to open in a new window, or copy and paste in a browser window. :frowning:

When I use this code:

$message_body .= "<span style='font-size: 12pt;'>URL: " . "<a href=" . "/>" . $_POST["url"] . "</a>" . "</span><br><br>";

the url comes through as a nice blue clickable link of the sent url, but it only links to the same page as the message it is sent to, and not the url that is highlighted.

Anybody have any insight? ;D Thanks, Bill


#2

You need to add the url inside the href attribute as well

[php]$message_body .= "URL: " . “<a href=” . $_POST[“url”] . “/>” . $_POST[“url”] . “” . “

”;[/php]


#3

JimL,

You certainly are a master PHP helper! Your solution worked like a charm (even though I have no idea why).

Thanks, Bill


#4

It worked because you were creating an url like this

[php]http://yoururl.com[/php]

But a HTML link tag does not by default link to the tags inner text, it only links to the url in the href attribute. So I just changed it to this

[php]http://yoururl.com[/php]

Meaning the link tag will both link to the url, and show the url as the link text