Reputation: 17
I am developing application in php using sqlite database. I have integrated tinymce 4.1.9 for textarea. When I saved data in database proper html script gets saved, but while displaying data from database on reports all html tags does not reflects. e.g H1 or list or bold does not show its effect. Even tags gets saved in database. Script is as follows :
<script language="javascript" type="text/javascript" src="tinymce/js/tinymce/tinymce.min.js"></script>
<script language="javascript" type="text/javascript">
tinymce.init({
selector: "textarea",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
]
});
</script>
Html :
<textarea name="txtAboutComp" class="form-control" rows="5" ></textarea>
Displaying data on reports:
<?php
try
{
$sqlite = new PDO('sqlite:DigitalStorageBox.sqlite');
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}
$statement = $sqlite->prepare('SELECT distinct ID, Name, LogoPath,CompanyName,AboutCompany from Company ');
try
{
$statement->execute();
}
catch (PDOException $e)
{
echo "Statement failed: " . $e->getMessage();
return false;
}
$result = $statement->fetchAll();
$cnt=0;
foreach ($result as $row)
{ echo $row['AboutCompany'];}
?>
Please suggest how to display formatted data on reports?
Upvotes: 1
Views: 1068
Reputation: 1498
Try using PHP htmlentities() function to convert characters into html format. Let me know the outcome.
Upvotes: 1