使用解决的问题$_REQUEST['editor1']而不是 $_POST['editor1']。不完全确定为什么。希望对遇到这个奇怪问题的人有所帮助。============================================问题描述:我正在将 CKeditor 集成到我的 HTML 表单中。Ckeditor 成功显示在表单上,我可以输入一些数据。但是当我尝试发布表单以存储在数据库中时,我注意到数据库条目缺少所有 HTML 左括号和右括号。试图在互联网上搜索但没有运气。请指教。我的数据库字段具有文本类型。我已经用 TinyMCE 替换了 Ckeditor,但还是一样。<div class="form-group"> <label for="content"><?=$str['content']?></label> <div class="input-group mb-3"> <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="20"></textarea> </div></div><!-- Initializing the editor --><script src="//cdn.ckeditor.com/4.12.1/full/ckeditor.js"></script><script type="text/javascript"> CKEDITOR.replace( 'editor1' );</script>我尝试使用以下数据输入 ckeditor textarea:<h3><a href="https://stackoverflow.com/questions/22904776/insert-ckeditor-html-code-into-the-database">Insert ckeditor html code into the database - Stack Overflow</a></h3><p> </p><p><a href="https://stackoverflow.com/questions/22904776/insert-ckeditor-html-code-into-the-database"><cite>https://stackoverflow.com/questions/.../insert-ckeditor-html-code-into-the-database</cite></a></p>但是当我存储在数据库中或检索 $_POST['editor1'] 数据时,我得到了这个:h3a href=https://stackoverflow.com/questions/22904776/insert-ckeditor-html-code-into-the-databaseInsert ckeditor html code into the database - Stack Overflow/a/h3 p /p pa href=https://stackoverflow.com/questions/22904776/insert-ckeditor-html-code-into-the-databasecitehttps://stackoverflow.com/questions/.../insert-ckeditor-html-code-into-the-database/cite/a/p缺少所有左括号和右括号。我做错了什么?下面是存储数据的代码:if (isset($_POST['submit'])) { $host = DB_HOST; /* Host name */ $user = DB_USER; /* User */ $password = DB_PASS; /* Password */ $dbname = DB_NAME; /* Database name */ $con = mysqli_connect($host, $user, $password, $dbname);// Check connection if (!$con) { die("Connection failed: " . mysqli_connect_error()); }
- 3 回答
- 0 关注
- 173 浏览
添加回答
举报
0/150
提交
取消