0

I have a form which accepts varchar2(5000). It is basically a description field. Now when users enter spces after paragraphs, they are all combined into on paragraph, and not multiple as it is entered.

Why? Ex - This is one paragraph.

This is another paragraph.

Here is what is happening -

This is one paragraph.This is another paragraph.

steve
  • 31
  • 2
  • 8
  • If you want this much chars then use `Text` as datatype. – Harry Joy Apr 22 '11 at 12:56
  • You should say a bit more about your platform - is this a form on a webpage, or a Windows Form application or what. How/where are you seeing the result that doesn't look how you expect? – Will Dean Apr 22 '11 at 12:58
  • Oh yeah...there are spaces in the database...but not being displayed..with echo in PHP..how do i solve this? Thanks – steve Apr 22 '11 at 13:00

1 Answers1

0

Are you displaying this data on a webpage or via HTML in some way? If so, then white-space is not handled in a straightforward fashion and that might be causing confusion.

Update - it appears that this is being displayed on a webpage.

You need to do one of several things:

  • Display your text inside a <pre> element on your page OR
  • Replace carriage returns in your text with <br/> chars before sending to the webpage (You might also need to do something with spaces too, if you need to have multiple of them displayed accurately).

This is nothing to do with databases and only to do with how HTML is displayed.

Have a look at this answer Rendering Plaintext as HTML maintaining whitespace – without <pre>

Community
  • 1
  • 1
Will Dean
  • 39,055
  • 11
  • 90
  • 118
  • Oh yeah...there are spaces in the database...but not being displayed..with echo in PHP..how do i solve this? Thanks – steve Apr 22 '11 at 12:59
  • i am gussing that
     is not safe, as if a user enters some malicious codem it will execute it right?
    – steve Apr 22 '11 at 13:04
  • @will which one should i follow? – steve Apr 22 '11 at 13:04
  • steve, I generally would not piss on someone who was on fire if they were the kind of person who thought 'u' was a useful contraction of 'you'. But I've added lots of info anyway. – Will Dean Apr 22 '11 at 13:05