我想通过在表单中使用wysiwyg来更新mysql 我在页面中放置了一个wysiwyg,并将其定义为id =“editor”,如下所示:
<form Method="post" action="post.php">
<input type="text" name="title" />
<div id="editor"></div>
<input type="submit" name="update" value="update">
</form>
并在post.php文件中:
<?php
if (isset($_POST['update'])){
$title=$_POST['title'];
$body=$_POST['editor'];
mysql_connect("x", "y","z")or die (mysql_error());
mysql_select_db('t')or die (mysql_error());
mysql_query("UPDATE news SET title='$title', body='$body' WHERE `id`='$_GET[update]'");
mysql_close();
header("location:new_page.php");
?>
proplem是在mysql中更新的第一个输入,但是$ body没有wysiwyg的sam值,或者它在mysql中没有更新?并且wysiwyg编辑推荐了一个div来编写一个编辑
答案 0 :(得分:0)
假设您正在使用TinyMCE - 您必须强制textarea在表单提交处理程序中从编辑器进行更新。
答案 1 :(得分:0)
“编辑器”不是输入,而是
<div id="editor">
你需要
<textarea id="editor" name="editor"></textarea>