Laureal
Laureal

Reputation: 25

Html tag in the string not working in browser

I am trying to display some information coming from the database. Database field takes the input from the ck-editor and save the HTML as a string.

enter image description here

Now when I am trying to display those data it comes like as the blue section in the above image. But I want it as the red section.

 echo "Product Name : Personal Loan<span><br>Loan Range :<br>Minimum : 50000<br>Maximum : 2000000<br>Loan Repayment Tenure :<br>Minimum 1 Year<br>Maximum 5 Years</span><br>";

When I use this code the red block section of the above image is showing

but when I use

echo $infos['Loan']['addtional_features'];

the blue section is showing. that is, the all string with the tag is displaying.

What could be the reason?

Upvotes: 1

Views: 1590

Answers (1)

Syscall
Syscall

Reputation: 19780

It seems like the string stored is HTML-encoded twice (e.g. &lt;br&gt;, instead of <br>). Try to html_entity_decode() your string, before to write it in the output.

Upvotes: 3

Related Questions