I am using codeigniter and mysql for web development. I have also used a rich-text editor called tinymce editor. My problem is I have applied the text-editor in a textarea. When I applied header and paragraph tags and etc its all okay but when I used to "center" the text it used the "style" tag of css, like style="text-align:center;" but when I insert it to database it does not include the double quotes "" the thing it will insert is only the style= and it will not include the "" and inside it.
The code below is used to insert data from the form including the textarea that was applied with the tinymce text-editor.
$("#send_email").click(function()
{
$("#myModal_loader").modal('show');
var email_add = $("#email").val();
var email_subject = $("#email_subject").val();
var email_message = tinymce.get('email_message').getContent();
var postData = {
'email_add':email_add,
'email_subject':email_subject,
'email_message':email_message
};
$.ajax({
type: "POST",
url: "<?php echo base_url();?>students/send_email",
dataType: 'json',
data: postData,
success: function(data)
{
$("#myModal_loader").modal('hide');
$("#myModal_confirm").modal('show');
$("#email_subject").val("");
$("#email_message").val("");
console.log();
}
});
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
</script>
controller
$this->course_booking_model->insert_email_data
($stored_email,$tennant_email,$email_subject,$email_message);
model
function insert_email_data($email_add,$tennant_email,$email_subject,$email_message) {
for($i=0;$i<count($email_add);$i++){
$data = array(
'email_add' => $email_add[$i],
'tennant_email' => $tennant_email,
'email_subject' => $email_subject,
'email_message' => $email_message
);
$this->db->set('time_sent','NOW()',FALSE);
$this->db->insert('email', $data);
}
}
email_message? - trrrrrrm