Hi!
Using CKeditor for the first time, insert into database text field gives lots of extra <br /> and line breaks.
Can anyone help please?
$body='';
<textarea name="txtBody" id="txtBody" rows="10" ><?= html($body);?></textarea>
The html function is htmlentities. Should I put it all in nl2br as well?
and for the SQL:
$title = mysql_real_escape_string($title);
$body = mysql_real_escape_string($_POST['txtBody']);
$priority = mysql_real_escape_string($_POST['selPriority']);
$show_item = mysql_real_escape_string($_POST['radShowItem']);
$sql = "INSERT INTO news (newsid, date_posted, title, body, show_item, priority)
VALUES ('', CURDATE(), '" . $title . "', '" . $body . "', '" . $show_item . "', '" . $priority . "')";
Using CKeditor for the first time, insert into database text field gives lots of extra <br /> and line breaks.
Can anyone help please?
$body='';
<textarea name="txtBody" id="txtBody" rows="10" ><?= html($body);?></textarea>
The html function is htmlentities. Should I put it all in nl2br as well?
and for the SQL:
$title = mysql_real_escape_string($title);
$body = mysql_real_escape_string($_POST['txtBody']);
$priority = mysql_real_escape_string($_POST['selPriority']);
$show_item = mysql_real_escape_string($_POST['radShowItem']);
$sql = "INSERT INTO news (newsid, date_posted, title, body, show_item, priority)
VALUES ('', CURDATE(), '" . $title . "', '" . $body . "', '" . $show_item . "', '" . $priority . "')";
Re: Phantom <br /> and line breaks
<script type="text/javascript">
CKEDITOR.replace( 'txtBody',
{
uiColor : '#F90',
on :
{
instanceReady : function( ev )
{
this.dataProcessor.writer.setRules( 'p',
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
}
}
});
</script>