Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get line breaks without entering code?

Tags:

html

css

php

I am trying to get text to enter into a database, but the text needs to have the line breaks that are entered into the textbox for when it is entered into the database, without having to enter <br /> every time there is a line break.

like image 978
Keegan Krantz Avatar asked Feb 03 '26 12:02

Keegan Krantz


1 Answers

So you want to make line breaks in a textbox and have these turn into <br /> when posted to the database, right?

nl2br() should do it. Just use this function on your string before posting it to the database.

like image 188
simonbs Avatar answered Feb 06 '26 01:02

simonbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!