I am storing html tags like <ul><li>....</li></ul>
, etc in the table. I want to retrieve these values as html content. When I retrieve this data I want to show it as HTML content, that is, it should show bullets instead of <ul><li>....</li></ul>
.
Code which I am trying:
<?php echo stripslashes($row3['description'])?>
I have even tried htmlentities()
, html_entity_decode()
but, none have worked.
Display HTML In Laravel Blade Views By default you would use the following syntax {{ $some_variable }} to echo out the content of a specific variable in Blade. By default the {{ }} escapes the HTML tags. In the first case, you can see how the HTML elements were escaped, and in the second case where we use {!! !!}
You can Use htmlspecialchars_decode
function as below :
echo htmlspecialchars_decode(stripslashes($row3['description']));
Instead of
echo stripslashes($row3['description']);
You can know more about function here : http://php.net/manual/en/function.htmlspecialchars-decode.php
for laravel users just do this
{!! $my_db_ish['my_row'] !!}
instead of
{{ $my_db_ish['my_row'] }}
Use htmlspecialchars_decode.
$str = "<ul><li></li></ul>";
echo htmlspecialchars_decode($str);
Hope it will help you :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With