1
I would like to know how to make the echo
PHP respect the line break of a text in the database.
I have a text field in the registration form like this:
<textarea id="descricao" name="descricao" class="input form-control col-lg-10" rows="5" required></textarea>
In the database it looks like this:
I would like that at the time of echo <?php echo $row['descricao']; ?>
, the same BD line break was respected in the exhibition.
But it’s all coming up on one line:
Cool, I didn’t know that function. I was going to have one
str_replace("\n", "<br>\n", $row['descricao'])
.– KaduAmaral
It worked! just out of curiosity that I had now. To display only as text, without the interpretation of html, as it would be?
– Tiago
@Kaduamaral yes, it is an option that also works
– 13dev
@James would be something like :
<?php echo strip_tags($row['descricao']) ?>
– 13dev
@13dev Thank you.
– Tiago