开发者

PHP retrieveing from SQL but forgetting linebreaks?

I'm using a Textarea element to allow users to update their "status".

All works fine but new lines disapear when I retrieve the text from the SQL? It SAVES them ok, and I can see them in PhpMyAdmin, but when I run this code after retrieving all the updates:

while($row = mysql_fetch_array($StatusResult))
{
  echo $row['Text'];
  if (GetLoggedOnId() == $_GET["UId"])
  {
    echo "<form>
          <input type=\"submit\" value=\"X\" name=\"REMOVE\"/>
          </form>";
  }
开发者_C百科  echo "<br/>";
}

it seems to just "forget" where linebreaks were.


Try this method when printing the string: nl2br


HTML ignores newline characters. Use nl2br() to convert the newline characters to <br> breaks that will display as expected in HTML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜