Is there any way I can make PHP/MySQL recognise the fact that there are paragraphs in a text field without having the user put in <p></p> or <br> tags in to format it?
it looks like you could use nl2br which would then convert the new lines in the field from MySQL to line breaks in HTML. Worth a try, hope it works for you
I don't think that really helps me as the user would still have to type /n
Really I want something like the text boxes on here where I can press return and the page will recognise the fact that I've done it without me having to type <br> or /n
Not really. \n is actually a carriage return, meaning that when user pushes enter, they insert \n and using the nl2br function will transfrom that into <br />. Now, it won't know when to put <p></p> but it will put <br /> in every occurence of enter making the text entered in say textarea look the same in html. Another option to preserve similar formatting to textarea is embedding text in <pre></pre> tags.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.