How do you echo a long space

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2Dcube
    New Member
    • May 2007
    • 1

    How do you echo a long space

    Hello,

    I'm doing some PHP and MySQL, and have a very simple question.

    How do you echo a long space? When I use echo " ": , it gets echo'd as only one space...

    Using echo " "; echo " "; echo " "; doesn't help either.

    Thanks in advance for answering :).

    2Dcube

    EDIT: what's funny is that every long space i typed here, got reduced to a single one as well... it's supposed to be: "____" that long..
  • Lick
    New Member
    • May 2007
    • 3

    #2
    This isn't a PHP problem, it's an HTML problem. By default the browsers eat away the whitespaces that come after the first whitespace. You can replace the whitespace by " " (without quotes) which the browser will recognize as a space.

    You could also set the CSS property "whitespace " to "pre" for the containing element. That will stop the browser from eating whitespaces.

    Comment

    • Omji

      #3
      Display informat as u write
      <?
      if($_POST['ok'])
      {

      $om=$_POST[t];
      //$om=nl2br($om);
      $new_string = str_replace(' ', '&nbsp;',$om) ;
      echo nl2br($new_stri ng);
      }
      ?>
      <form method="post">

      <textarea name="t"></textarea>
      <input type="submit" name="ok">
      </form>

      Comment

      • Reza Ruslan

        #4
        I think the answer from @ Lick is on target, and I just wanted to add a suggestion .. to write a long space you should use

        echo "&nbsp;&nbs p;";

        or

        echo"&nbsp;[space]&nbsp;"; to gain a longer space...

        CMIIW

        Comment

        Working...