使用解決的問題$_REQUEST['editor1']而不是 $_POST['editor1']。不完全確定為什么。希望對遇到這個奇怪問題的人有所幫助。============================================問題描述:我正在將 CKeditor 集成到我的 HTML 表單中。Ckeditor 成功顯示在表單上,我可以輸入一些數(shù)據(jù)。但是當我嘗試發(fā)布表單以存儲在數(shù)據(jù)庫中時,我注意到數(shù)據(jù)庫條目缺少所有 HTML 左括號和右括號。試圖在互聯(lián)網(wǎng)上搜索但沒有運氣。請指教。我的數(shù)據(jù)庫字段具有文本類型。我已經(jīng)用 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>我嘗試使用以下數(shù)據(jù)輸入 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>但是當我存儲在數(shù)據(jù)庫中或檢索 $_POST['editor1'] 數(shù)據(jù)時,我得到了這個: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缺少所有左括號和右括號。我做錯了什么?下面是存儲數(shù)據(jù)的代碼: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 關注
- 206 瀏覽
添加回答
舉報
0/150
提交
取消