View Full Version : How to remove %0D%0A before inserting $_GET['rte1'] in my database ?

01-14-2007, 08:27 PM
hi there,

I first reported this problem on the php forum but I think it is a mysql problem.

I try to save the content of $_GET['rte1'] (once the form as been sumited) into my mysql database.
the INSERT works but since the RTE adds some %0D%0A at the end of the $_GET['rte1'] value, when I try to reuse that content as the preload html code of the RTE, the RTE doesn t work any more. (the code bellow works only if I "manually" insert some html code in my database, when I use INSERT it adds 2 blank lines)

$sql = "SELECT test FROM test";
$req=mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
<script language="JavaScript" type="text/javascript">
writeRichText('rte1', '<?php echo $test;?>', 520, 400, true, false);

Someone knows how I can get rid of these %0D%0A before filling the db?

thank you:)

01-14-2007, 08:38 PM
Just $test = str_replace(array("\n", "\r"), array('\n', '\r'), $data['test']);

01-14-2007, 09:11 PM