View Full Version : Embed a link in Newsletter

12-04-2003, 03:54 PM
Hello Again All,

I have a php mailing List script that I want to embed an unsubscribe link into.

The problem is that the link is not showing up in the news letter but the code is.

I thought it may have been because it needed stripslashes so I did that.
Here is the code:
<td><textarea name="message" cols="40" rows="8" id="textarea" class="box"><?php
$str = "<a href=\"http://www.mysite.com\">Unsubscribe here</a>";
echo stripslashes($str);

But this is the result in the newsletter:

Test 3<a href=\"http://www.mysite.com\">Unsubscribe here</a>

Any insight as to how I can correct this would be great!


12-07-2003, 12:25 PM
add a second stripslashes
echo stripslashes(stripslashes($str));
that should do it...

12-07-2003, 02:09 PM
No, you don't have to stripslashes twice.

echo stripslashes($str);

12-07-2003, 02:27 PM
SDP, you do for textareas and stuff sometimes, when that stupid magic quotes or whatever it's called is turned on

12-07-2003, 05:17 PM
but, for the simple code NYColt is using here, he really shouldn't have to.

BTW if you're sending the HTML in an email, you shouldn't be echoing it, you should just have it contained in the string you send as the body...

$body .= '<a href="http://www.mysite.com">Unsubscribe here</a>';
fputs ($connect, "Subject: $subj\r\n");
fputs ($connect, "MIME-Version: 1.0\r\n");
fputs ($connect, "Content-Type: text/html; charset=us-ascii\r\n");
fputs ($connect, "Content-Transfer-Encoding: 8bit\r\n");
fputs ($connect, "\r\n");
fputs ($connect, "$body\r\n");
fputs ($connect, ".\r\nQUIT\r\n\r\n");