-
How to remove %0D%0A before inserting $_GET['rte1'] in my database ?
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)
<?php
$sql = "SELECT test FROM test";
$req=mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
$data=mysql_fetch_assoc($req);
$test=$data['test'];
?>
<script language="JavaScript" type="text/javascript">
<!--
writeRichText('rte1', '<?php echo $test;?>', 520, 400, true, false);
//-->
</script>
Someone knows how I can get rid of these %0D%0A before filling the db?
thank you
lolo
-
-
Just $test = str_replace(array("\n", "\r"), array('\n', '\r'), $data['test']);
-
-
Last edited by lolo; 01-14-2007 at 09:39 PM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks