emailing a link isn't working
I'm trying to email some stuff that is retrieved from a form. Seems fairly simple and works fine... until I add in a link.
In the form if I add
in the email it shows up as blue text but it isn't underlined and it doesn't link.
<a href="http://google.com">click me</a>
In my php I have the following:
Any ideas as to why and or fixes?
#convert line breaks into code line breaks
$final_content = str_replace("\r\n", "\r\n<br>\r\n", $_REQUEST["main"]);
$to = $row['email'];
$subject = "email testing";
$message_final = "<html><body>Hi " . $row['name'] . ", <br><br>This is an email with the content below from the forms.<br><br><i><font size='3'><b>" . $_POST['heading'] . "</b></font><br><br>" . $final_content . "</i></body></html>";
$mailheader = "From: mysite.com\r\n";
$mailheader .= "Reply-To: firstname.lastname@example.org\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, $subject, $message_final, $mailheader);
Ok I solved it by adding
unless this is bad for some reason (keeping in mind it doesn't have to be 100% secure for what I'm doing) then it's all solved
$final_content = stripslashes($final_content);
Sounds like you have the dreaded magic_quotes_gpc "feature" enabled. You might want to turn it off if possible, then not have to mess with the stripslashes(), or you can apply it to all input arrays as described in this article (though you would need to add a call to array_walk_recursive() for the $_REQUEST array, too, if you're going to use it (I never do).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
haha yeah funnily enough you replied to another thread of mine with the same answer. Those damn magic quotes are killing me! I think for this it's not too bad to leave it as it's only one string and will probably only ever be one string. I might contact my host about turning it off but this will do for now.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread