Page 1 of 1

Rich text form posting

Posted: Sun Mar 13, 2005 9:47 pm
by thesimon
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.

Posted: Sun Mar 13, 2005 9:53 pm
by feyd
I don't see how "test file.pdf" turns into "testfile.pdf" .. can you post the code?

Posted: Mon Mar 14, 2005 12:36 am
by thesimon

Code: Select all

&lt;form name=&quote;form1&quote; method=&quote;post&quote; action=&quote;cms-send.php&quote;&gt;
     &lt;script type=&quote;text/javascript&quote;&gt;
          var oFCKeditor = new FCKeditor( 'msg' ) ;
     oFCKeditor.Value = 'Please use the link below to download my newsletter&lt;br&gt;&lt;a href=&quote;http://localhost/knewsl/&lt;?php echo $row_Recordset1&#1111;'path']; ?&gt;&quote; &gt;Click here to download and view newsletter &lt;/a&gt;'
     
     oFCKeditor.Height = 400 ; // 400 pixels
     oFCKeditor.Width = 600;
     oFCKeditor.Create() ;
    &lt;/script&gt;
	
	  
	    &lt;br&gt;
      &lt;/p&gt;
   
      &lt;input type=&quote;submit&quote; name=&quote;Submit&quote; value=&quote;Submit&quote;&gt;	
      &lt;/form&gt;

Code: Select all

&lt;?php 
require(&quote;class.phpmailer.php&quote;);

$mail = new PHPMailer();
$mail-&gt;IsSMTP(); // telling the class to use SMTP
$mail-&gt;Host = &quote;host.com&quote;; // SMTP server
$mail-&gt;FromName = &quote;fromname&quote;;
$mail-&gt;IsHTML(true); 
$mail-&gt;From = &quote;from&quote;;
do { 
$mail-&gt;addBcc($row_Recordset1&#1111;'email']);
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$mail-&gt;Subject = &quote;From Website&quote;;
$mail-&gt;Body = $_POST&#1111;'msg'] .&quote;&lt;br&gt;&lt;br&gt;&lt;strong&gt;Sent from website. &lt;/strong&gt;&quote; ;
$mail-&gt;Body .= '&lt;br&gt;&lt;a href=&quote;http://www.site/unsubscribe.php&quote;&gt;Unsubscribe from this mailing list&lt;/a&gt;' ;
$mail-&gt;WordWrap = 50;

if(!$mail-&gt;Send())
{
   echo &quote;Message was not sent&quote;;
   echo &quote;Mailer Error: &quote; . $mail-&gt;ErrorInfo;
  
}
else
{
   echo &quote;Your message has been sent&quote;;
}


 ?&gt;

feyd | Please use

Code: Select all

and

Code: 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]

Posted: Mon Mar 14, 2005 12:49 am
by feyd
on page 1, see what echo'ing the record set variable through rawurlencode() does.