Hi
I have two pages
------------
1)
A form with a rich text box and a submit button.
2)
A page which receives the value from the rich text box and emails out to addresses in a column in a table
------------
For the rich text box its default value is a message saying: “Click the link below to download the latest newsletter” and a link which get the file path from a table in the db. Users can then add a message above the link to the newsletter. Now this all works fine except for the link, (and any other links I make using the rich text box), firstly when the form is posted a \ is placed before the “, ie <a href\”url.com.au\”>Link</a> which renders the link useless.
Someone suggested stripslashes, which I put on the second page where it receives the variable; $_POST[‘msg’], this did remove the slashes however I then had a problem with spaces in the file path for the newsletter, ie; url.com/testfile.pdf would be sent instead of url.com/test file.pdf which it should be.
Then someone suggested urlencode however that encoded the entire message, so they got Click%20the%20link%20below……
If anyone could help I would be most grateful, I want to be able to send these default links from the rich text box as well as allow users to add links in the rich text box.
Rich text form posting
Moderator: General Moderators
Code: Select all
<form name="e;form1"e; method="e;post"e; action="e;cms-send.php"e;>
<script type="e;text/javascript"e;>
var oFCKeditor = new FCKeditor( 'msg' ) ;
oFCKeditor.Value = 'Please use the link below to download my newsletter<br><a href="e;http://localhost/knewsl/<?php echo $row_Recordset1ї'path']; ?>"e; >Click here to download and view newsletter </a>'
oFCKeditor.Height = 400 ; // 400 pixels
oFCKeditor.Width = 600;
oFCKeditor.Create() ;
</script>
<br>
</p>
<input type="e;submit"e; name="e;Submit"e; value="e;Submit"e;>
</form>Code: Select all
<?php
require("e;class.phpmailer.php"e;);
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "e;host.com"e;; // SMTP server
$mail->FromName = "e;fromname"e;;
$mail->IsHTML(true);
$mail->From = "e;from"e;;
do {
$mail->addBcc($row_Recordset1ї'email']);
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$mail->Subject = "e;From Website"e;;
$mail->Body = $_POSTї'msg'] ."e;<br><br><strong>Sent from website. </strong>"e; ;
$mail->Body .= '<br><a href="e;http://www.site/unsubscribe.php"e;>Unsubscribe from this mailing list</a>' ;
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo "e;Message was not sent"e;;
echo "e;Mailer Error: "e; . $mail->ErrorInfo;
}
else
{
echo "e;Your message has been sent"e;;
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
on page 1, see what echo'ing the record set variable through rawurlencode() does.