up vote
0
down vote
favorite
I am programing new websit which add topics to database. I made input for title and textarea for content and i use wysiwyg editor with the textarea to add some effects to my articles. The problem is that when i try to insert data to db it fails to insert the content of textarea and when i remove the wysiwyg it works perfectly. Pleas is there any solution . by the way the language i am using is php and i use jqury to insert data without refreshing the page. this is the code i am using===>
ajax.js
[php]$(’#share’).click(function(){
var title=$("#tilearticle").val();
if(title== ‘’){$(’#tiart’).show(‘slow’);}
else{
var datastring= $("#form1").serialize();
var url1=‘action.php?action=article’;
$.post(url1,datastring,function(info){$("#res").html(info);});
}
});
[/php]
action.php
[php]
if($_GET[‘action’]==‘article’){
$get=$_GET[‘action’];
$title=$_POST[‘title’]; // get data from title input
$content=$_POST[‘ckeditor1’]; // get data from textarea
$image=$_POST[‘image’];
$date=date(“Y/m/d”);
$newtitle=string_limit_words($title, 6);
$urltitle=preg_replace(’/[^a-z0-9]/i’,’ ‘, $newtitle);
$newurltitle=str_replace(" “,”-",$newtitle);
$url=’/’.$newurltitle.’.html’;
$sql=mysql_query(“INSERT INTO article (id,title,img,content,url,time ) VALUES
(’’,’”.$title."’,’".$image."’,’".$content."’,’".$url."’,’".$date."’)") or die(mysql_error());
if($sql){
echo ‘work’;}else{echo ‘nooo’;}
}[/php]
add.php // add article page
[php]
Example block-level help text here.