Jump to content

getting test to save breaks in database


smartin1017

Recommended Posts

I looked into that function but for soeone coming to the site and filling in info they are not going to know to put in /n. Think of a social network, you fill in all these different textareas and they always show the paragraphs with the breaks. How do they do this, I am thinking they might use javascript with php. Any ideas?

Link to comment
Share on other sites

I looked into that function but for someone coming to the site and filling in info they are not going to know to put in /n. Think of a social network, you fill in all these different textareas and they always show the paragraphs with the breaks. How do they do this, I am thinking they might use javascript with php. Any ideas?

 

They dont put in "\n".  Whenever you press the Enter key on your keyboard, that is where the "\n" comes from. So people filling out a bio would just hit Enter, which would take them to the next line, like this

 

and the nl2br() function will make sure that, when you display the text, the \n's are preserved.

 

Does that make sense?  \n is a whitespace character, that means that nobody sees it.  Spacebar is represented by \s, and tabs are represented by \t, they are also whitespace characters.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.