我在php中创建了多个ckeditor,它可以正确显示ckeditor的面板,但是当我在其中添加内容后单击更新时,它没有保存到数据库中。
<?php
if(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>
繁华开满天机