Jump to content

PHP variable is an Email link, NOT!


robber2

Recommended Posts

Here's a tricky one, but you're brilliant so you already know the answer:So I wrote some PHP code (w/ a lot of help!) and now I have a form that collects and sends data submitted from the form to my email. One of the things it sends is the email add. from the form, and the variable (?) goes like this:

$message .= "Email: " . "<a href=>" . stripslashes($_POST['email']) . "</a>" . "<br />";

So, when I get the email add. in my rec'd email message, I see it's a link, blue, underline, that old chestnut. When you hover over it, up pops the little "I'm a link" hand. But when you click it, it should launch a new email with the linked add. in the To: field, right, but it don't. Doesn't. Whatever. Why? Here's the kicker: now forward it to someone else, yer buddy Babs. Babs gets it, it's got the link, Bab clicks, Babs composing a new email. Curious.Need more info? Here's the page in question:http://www.perfectionconstruction.com/Luth...test/mail7a.phpWant the full version PHP? If it'll help, I'll post back.And thanx.

Link to comment
Share on other sites

It is because you have to specify a href for the email, you can't just write <a href=>address@domain.com</a>. You also need to specify the mailto: pseudo-protocol.Change your code to

$address = stripslashes($_POST['email']);$message .= "Email: <a href=\"mailto:$address\">$address</a><br />";

In forwarding, some email clients fix up bad code, and will also hyperlink web and email addresses. So Babs will receive a patched up version.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...