PHP an "

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello, I have the following problem.

I have a Mysql db field which holds an html code (e.g. <p
style="text-decoration: underline;">lala</p>).
To insert this code I use the ricEdit javascript controll with which you
create a textarea and format the text. When I submit the value it is
stored in the db.

I want to be able to edit this code (from a web form) so I want to
retrive the code and pass it to the javascript control. I get it to a
var like: $line["text"].
If I do <input type="text" value="<?php echo $line["text"];?>"> there is
a problem with the " in the html code. I trie to do a
addslashes($line...) but what I get is something like:

original:  <p style="text-decoration: underline;">lala</p>
addslashed:  <p style=\"text-decoration: underline\>lala</p> (last " is

so everything is messed. I also tried str_replace('"','\"',$line[]) but
the same thing happens.

Is there a problem with ;" ??? How can I overcome it?

Re: PHP an "

G0ng wrote:
Quoted text here. Click to load it

E. Dronkert

Re: PHP an "

Ewoud Dronkert wrote:
Quoted text here. Click to load it

Ok this is ok for the HTML part. It is displayed correctly. But what I
want to do is pass it to a javascript function. So I do
<script language="javascript">
    var ed=new EDITOR();

but the .create function needs the argument to be <b> and not &lt;b$gt;

Is there any other way to this DB field in my javascript?


Site Timeline