Hi all,
I am using PHP to save content of the editor window to MySQL database. The last version of editor worked fine, but now when I insert image, with source code
<img height="28" src="/data/Image/pis-4.jpg" width="20" alt="" />
after saving, it suddenly becomes
<img height="\""28"\"" alt="\"""\"" src="\""/data/Image/pis-4.jpg"\"" width="\""20"\"" />
and I don't understand what is the problem. I tried to use stripslashes and htmlspecialchars, but when I used stripslashes, it did not solve the problem and htmlspecialchars only made the HTML preview like the source preview - very strange.
If someone has the solution, I would realy appreciate it. Can somebody please paste som PHP code to maintain clean and unchanged code for posting data to MySQL? I use method POST and I receive string by $_POST[] variable.
Thanks a lot.
I am using PHP to save content of the editor window to MySQL database. The last version of editor worked fine, but now when I insert image, with source code
<img height="28" src="/data/Image/pis-4.jpg" width="20" alt="" />
after saving, it suddenly becomes
<img height="\""28"\"" alt="\"""\"" src="\""/data/Image/pis-4.jpg"\"" width="\""20"\"" />
and I don't understand what is the problem. I tried to use stripslashes and htmlspecialchars, but when I used stripslashes, it did not solve the problem and htmlspecialchars only made the HTML preview like the source preview - very strange.
If someone has the solution, I would realy appreciate it. Can somebody please paste som PHP code to maintain clean and unchanged code for posting data to MySQL? I use method POST and I receive string by $_POST[] variable.
Thanks a lot.
RE: While saving - the source becomes unreadable
First I had to encode the string using htmlentities.
$textnormal = $_POST["postedvariable"];
$text_encoded = htmlentities($textnormal);
then when I wanted to display the results, FCK editor needs to know the exact string decoded, so I had to do the reverse
$text_decoded = html_entity_decode($_POST["posted variable"]);
.
.
.
.
RE: While saving - the source becomes unreadable
Ok, I finaly got it working this way:
First I had to encode the string using htmlentities.
$textnormal = $_POST["postedvariable"];
$text_encoded = htmlentities($textnormal);
then when I wanted to display the results, FCK editor needs to know the exact string decoded, so I had to do the reverse
$text_decoded = html_entity_decode($_POST["posted variable"]);
.
.
.
.
Ok, I finaly got it working this way:
First I had to encode the string using htmlentities.
$textnormal = $_POST["postedvariable"];
$text_encoded = htmlentities($textnormal);
then when I wanted to display the results, FCK editor needs to know the exact string decoded, so I had to do the reverse
$text_decoded = html_entity_decode($_POST["posted variable"]);
.
.
.
.
$oFCKeditor->Value = $value;
.
.
.
now its going to work with pictures and even a large amount of HTML.