我在php中创建了多个ckeditor,它可以正确显示ckeditor的面板,但是当我在其中添加内容后单击更新时,它没有保存到数据库中。<?phpif(isset($_POST["action"])&&($_POST["action"]=="update")){ $id = $_POST['id']; $content = $_POST['content'];$query_update = "UPDATE `correspond` SET content='$content' WHERE id='$id'"; mysql_query($query_update);header("Location: correspond.php");}?><table><?php while($row_correspond_result=mysql_fetch_assoc($correspond_result)){ ?><tr class="table table-bordered table-striped"><form action="" method="POST" name="correspond_form" id="correspond_formJoin"><tbody id="myTable"><td colspan="3" align="center"><div contenteditable="true" class="myContent" id="content"><?php echo $row_correspond_result["content"];?> </div><script>var elements = document.getElementsByClassName( 'myContent' );for ( var i = 0; i < elements.length; ++i ) {CKEDITOR.inline( elements[ i ], { /* config for this instance */ } );}});</script></td></tr><tr><td colspan="2"></td><td align="center"><input name="action" type="hidden" id="action" value="update"><input type="submit" name="Submit" value="Update"></td></form></tr><?php }?> </tbody></table>
2 回答
繁华开满天机
TA贡献1816条经验 获得超4个赞
这个 div 转换为 TextArea
从
<div contenteditable="true" class="myContent" id="content"><?php echo $row_correspond_result["content"];?> </div>
至
<textarea contenteditable="true" class="myContent" id="content"><?php echo $row_correspond_result["content"];?> </textarea>
- 2 回答
- 0 关注
- 225 浏览
添加回答
举报
0/150
提交
取消