Hello all 🙂 I'm making a Gbook and i wonder when i wanna have a newline like this
i have to use <br><br> to get it... But in this forum they get a newline without using <br> just by hitting enter... How can i do the same in my Gbook... The Gbook is using a mysql database... Thanks 🙂 //Johan
use nl2br(); 🙂 The html tag which allow to create a new line is <br> (or <p>).
The input from the textarea is input into the db after some validation.
When it is retrieved from the db for display you run nl2br() on the string and it adds <br>s before the new lines.
$string = "Hello world.\n\nGood Bye World"; $string = nl2br($string); echo $string; // prints "Hello world.<br />\n<br />\nGood Bye World"
Hope this helps 😉
Hmmm... I didn't get a email for this one? wierd... Anyway Thanks for the help... i solved it with a
$text = str_replace("\n", "<br>", $text);
that did the trick 🙂 //Johan