Forum Moderators: coopster

Message Too Old, No Replies

format output

why \t and \n does not work?

         

sqlnew

8:43 pm on Sep 27, 2005 (gmt 0)

10+ Year Member



Hello, all
I wanted to format my output,
for example:

$msg = "Name\t\tPhone\t\tAddress\n\n";
echo $msg;

but the \t and \n failed to work properly. I mean there is no space between 'Name', 'Phone' and 'address' and there is no new line after 'Address'.
Any suggestions?

Thanks.

jatar_k

8:57 pm on Sep 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if you view source they should be.

if you want them formatted in the browser then you will need to use html.

sqlnew

9:43 pm on Sep 27, 2005 (gmt 0)

10+ Year Member



Thank you very much for your reply. I need show this in browser. I didn't use HTML a lot. Could you please show me how to leave tab space in HTML?

Thanks again.

coopster

10:12 pm on Sep 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You need to format it with HTML. A quick and easy solution is to wrap it in <pre> tags:
$msg = "<pre>Name\t\tPhone\t\tAddress\n\n</pre>"; 
echo $msg;

sqlnew

1:22 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



It works. Thank you very much for your help.