...

View Full Version : Embed a link in Newsletter



NYColt
12-04-2003, 02: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);
?>
</textarea></td>

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!

Thanks
NYColt

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

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


<?php
echo stripslashes($str);
?>

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

x_goose_x
12-07-2003, 04: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");
...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum