Nikita
Nikita

Reputation: 199

Store Text with Line Break in MySQL DataBase

So i have a Simple Question , i am trying to get the Text from an Html Form , then add a '\n' on each Request , for Line Break , i have tried this :

 '".$customtext."'.'\n'

Or this :

 '".$customtext.'\n'"'

with no luck , is there a way to do it ?

Thanks you .

Upvotes: 2

Views: 2985

Answers (2)

Juanillo
Juanillo

Reputation: 11

You need to use double quotes (For example: $var_to_print = $str . "\n";) // will not work using simple quote '

I'm not sure if u are looking for this, or may you want to use a while/foreach bucle to replace each "\n" to "< br>"

hope it helps!

Upvotes: 1

Matthias W.
Matthias W.

Reputation: 1077

Try $customtext."\n" -- double quotes should fix the problem. Edit: and if you want to output within HTML code you can take a look at the function nl2br.

Upvotes: 0

Related Questions