Hello you PHP-gurus,
I've put the following code on a page:
Code:
<?php
$fn = "file.html";
$file = fopen($fn, "r+");
$size = filesize($fn);
if($_POST['addition']) fwrite($file, $_POST['addition']);
$html = fread($file, $size);
fclose($file);
?>
<form name="myform" action="<?=$PHP_SELF?>" method="post" target="frame">
<div id="the_content" contenteditable="true" >
<?=$html?>
</div><br>
<input type="text" name="addition" id="addition" style="display:none">
</form>
<button onmouseover="document.getElementById('addition').focus();document.getElementById('addition').value=document.getElementById('the_content').innerHTML" onmouseup="document.myform.submit();">Save</button>
<iframe name="frame" style="display: none"></iframe>
The code works fine. Whatever I write in the contenteditable div is saved and stored on the server.
My problem is the behavior of one of my servers. Whenever I put something between quotes in the contenteditable div, it (the server) ads a backslash. I've googled around and tried all kinds of suggestions but without succes. Does anyone have a solution for this particular case?
Thanks.
Bookmarks