blackcat Posted April 11, 2007 Share Posted April 11, 2007 I dont know why the browser doesn't present the php string with some escape character like \n,\t.... For example: the string "Name\nAddress" should be printed out like Name Address instead it prints out "Name Address".I tried other ones and do not work. Anyone know why? Quote Link to comment Share on other sites More sharing options...
per1os Posted April 11, 2007 Share Posted April 11, 2007 You need to use nl2br() www.php.net/nl2br That should solve your issue for the line break. Why it is doing that is because html does not notice the line break on the gui portion of the page. It will behind the scenes in the source. But in order to have it display with the break you need to convert the \n to < br /> Quote Link to comment Share on other sites More sharing options...
nogray Posted April 11, 2007 Share Posted April 11, 2007 for a line break on a browser, you need to use HTML < br /> tag instead of \n Or you can put your output between < pre>< /pre> tag (spaces added to tag so they show up) Quote Link to comment Share on other sites More sharing options...
Barand Posted April 11, 2007 Share Posted April 11, 2007 you need 'pre' tags for html to recognise \n \t etc echo "<pre>Name\n\tAddress</pre>"; -->[pre] Name Address [/pre] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.