I am unable to save content written inside the editor to my database.
I have noticed that if i change the div to textarea, it saves just fine to the database. But that 'solution' removes the functionality of the wysiwyg and is unable to save in rich data format, which I need.
So how do I save to my database with divs?
Heres my code:
<form method="post" action="index.php">
<div id="editor" name="test">
<?
$sql = "SELECT blaabog FROM brugere WHERE id='1'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo $row["blaabog"];
}
?>
</div>
<button class="btn btn-default" type="submit">Send Post</button>
</form>
If I change my code to this, it saves to the database, but as described above ruins other functionality..
<form method="post" action="index.php">
<textarea id="editor" name="test">
<?
$sql = "SELECT blaabog FROM brugere WHERE id='1'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo $row["blaabog"];
}
?>
</textarea>
<button class="btn btn-default" type="submit">Send Post</button>
</form>
How do I fix this so I am able to save to my database in rich data format?
Thanks
If someone has the same problem I have a solution:
I changed my wysiwyg editor to TINYmce, which stores the information in the database just fine with the following code:
Editor code:
PHP:
} }
?>
And some more PHP:
I am not sure how but the code above works. I bought a solution from a professional - so sorry if my explaination is bad.
Anyway, if you have the same problem as me, the code above should do trick!