can't recover spaces from text put into mysql database table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baked
    New Member
    • Feb 2010
    • 1

    can't recover spaces from text put into mysql database table

    Hi, I am using an html form to put a text into a Mysql database table. Using PHP V5

    When I recover and display only one space between each word is seen irrespective of how many I add.

    The spaces are all present in the database table. I just cant seem to recover them.

    Can any onr help?

    Regards

    Baked
  • itsloop
    New Member
    • May 2009
    • 18

    #2
    baked actually its HTML behavior it only displays only one space but if you view it in source view you will find theses for solving this problem replace the   where you using space.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Yep, spaces are not treated the same way in HTML as they are in normal text. They have a specific purpose in the HTML markup, so they do not get rendered the same way they would in a normal text document.

      There are three ways to get around this.
      1. As itsloop suggested, replace the space characters with   - This is the HTML entity used to represent a space inside the HTML markup.
      2. Wrap the text in <pre> or <code> tags. This will cause the contents of those elements to be rendered as plain-text.
      3. Add the "white-space: pre" CSS style to the element containing the text. This will make that element emulate the behavior of the <pre> element.

      Comment

      • itsloop
        New Member
        • May 2009
        • 18

        #4
        precised reply Atil. nice.

        Comment

        • itsloop
          New Member
          • May 2009
          • 18

          #5
          in my understading html allows one charachter for providing easyness for the visitors and may if they space being used as entered then it would a very big problem for code indentation.

          Comment

          Working...