如果我在Markitup wysiwyg上添加一些文本,并且我发送了表单,它就不会在POST变量中保存文本区域的内容......有人知道为什么吗?
`<textarea id="markItUp" cols="80" rows="15" name="contenuto" placeholder="content" required></textarea>`
这是查询:
<script type="text/javascript">
$(function() {
$('#markItUp').markItUp(mySettings);
// You can add content from anywhere in your page
// $.markItUp( { Settings } );
$('.add').click(function() {
$('#markItUp').markItUp('insert',
{ openWith:'<opening tag>',
closeWith:'<\/closing tag>',
placeHolder:"New content"
}
);
return false;
});
// And you can add/remove markItUp! whenever you want
// $(textarea).markItUpRemove();
$('.toggle').click(function() {
if ($("#markItUp.markItUpEditor").length === 1) {
$("#markItUp").markItUp('remove');
$("span", this).text("get markItUp! back");
} else {
$('#markItUp').markItUp(mySettings);
$("span", this).text("remove markItUp!");
}
return false;
});
});
</script>
这是我所包含的:
<link rel="stylesheet" type="text/css" href="markitup/skins/markitup/style.css" />
<link rel="stylesheet" type="text/css" href="markitup/sets/default/style.css">
<!-- jQuery -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<!-- markItUp! -->
<script type="text/javascript" src="markitup/jquery.markitup.js"></script>
<script type="text/javascript" src="markitup/sets/default/set.js"></script>
有人有想法吗? 我通过POST传递变量:
...<form action="addnews.php" method="post" enctype="multipart/form-data">...
<?php
$news = new News();
$news->crea($_POST,$image,$userProfile['name']);
//...
?>
这是新闻类的“crea”方法:
<?php
public function crea($_POST,$immagine,$autore)
{
$db = new Database();
$db->connect();
$titolo = mysql_real_escape_string($_POST['titolo']);
$contenuto = mysql_real_escape_string($_POST['contenuto']);
$tags = mysql_real_escape_string($_POST['tags']);
$titolo_url = str_replace(
// Replace these special characters
array('.',',',':',';','?','!',' ', '<', '>', '&', '\'', '"', '‘', '’', '“', '”', '/', '[', ']','(',')','\'','è','é','à','ò','ù','ì','ì', 'è', 'é', 'ò', 'à', 'ù'),
// With the HTML entities below, respectively
array('','','','','','','-','-','-','-','-','','','','','','-','-','-','-','-','-','e','e','a','o','u','i','i', 'e', 'e', 'o', 'a', 'u'),
$titolo);
$db->insert('news',array('titolo' => ''.$titolo.'','titolo_url' => ''.$titolo_url.'','data' => ''.time().'','contenuto' => ''.$contenuto.'','autore' => ''.$autore.'','tags' => ''.$tags.'','immagine' => ''.$immagine.''));
$result = $db->getResult();
if ($result == true)
return $result;
}
?>
如果我不使用Markitup,所有权利,但是因为我已经安装了它,所以“内容”不起作用。