Good morning, I did a text editor with php js and a little jquery for the slide effect of the link. But it is not storing in the database and does not accuse me of any error can someone tell me how to solve it? thanks in advance
<?php
require "bd.php";
if (!empty($_POST['titulo']) && !empty($_POST['corpo'])) {
$titulo = addslashes($_POST['titulo']);
$post = htmlentities($_POST['corpo'], ENT_QUOTES);
$data = date('d-m-Y');
$sql = $pdo->prepare("INSERT INTO post (titulo, conteudo, data) VALUES
(:titulo, :conteudo, NOW())");
$sql->bindValue(":titulo", $titulo);
$sql->bindValue(":conteudo", $post);
$sql->bindValue(":data", $data);
$sql->execute();
header ("location: dashboard.php");
exit;
}else{
echo "ainda não deu certo";
}
?>
<!DOCTYPE html>
Post
<div id="eda" >
<div id="edmenu">
<button id="b" onclick="bold()"><b>B</b></button>
<button id="i" onclick="italic()"><i>I</i></button>
<button id="u" onclick="under()"><u>U</u></button>
<button id="link">Link</button><br>
<ul id="fl">
<li><input type="text" name="linke" placeholder="coloque
a URL" id="vlink" value="http://www."></li>
<li id="ok" onclick="linkar()" ><button >Ok</button>
</li>
</ul>
<select id="fonts" onclick="fontFam();">
<option></option>
<option value="Times New Roman">Times new Roman</option>
<option value="Tahoma">Tahoma</option>
<option value="Consolas">Conolas</option>
<option value="Monospace">Monospace</option>
<option value="Sans-Serif">Sans-Serif</option>
<option value="Calibri">Calibri</option>
</select>
<select id="fontsize" onclick="fontTam();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<label for="file-input" id="imagem">
<img src="imageicon.jpg"width="30" height="30"
name="imagem">
</label>
</div>
<form method="POST" id="fte" name="fte">
<input type="text" name="titulo" placeholder="Titulo" id="titulo">
<br>
<textarea id="corpo" name="corpo" style="display: none"></textarea>
<iframe id="conteudo" name="conteudo" >
</iframe><br>
<input type="submit" name="enviar" id="enviar" onclick="envie();">
</div>
</form>
<script type="text/javascript" src="editor.js"></script>
</section>
<footer>
</footer>
The file js
function iframe() {
conteudo.document.designMode = 'on';
}
function bold(){
conteudo.document.execCommand('bold', false, null);
}
function italic(){
conteudo.document.execCommand('italic', false, null);
}
function under(){
conteudo.document.execCommand('underline', false, null);
}
function fontTam(){
var se = document.getElementById('fontsize').value;
conteudo.document.execCommand('fontSize', false, se);
}
function fontFam(){
var fa = document.getElementById('fonts').value;
conteudo.document.execCommand('fontName', false, fa);
}
function linkar(){
var vl = document.getElementById('vlink').value;
conteudo.document.execCommand('createLink', false, vl);
}
function envie(){
document.getElementById("corpo").value =
window.frames['conteudo'].document.body.innerHTML;
document.getElementById("fte").submit();
}