For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2004 > weird things









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author weird things
jg

2004-03-26, 11:13 pm

I posted the question earlier about the variables in the select statement
(still doesn't work) I just noticed something else, \n does not work either.
Ex.
<?php echo("this is line 1\n");
echo("this is line 2\n");
?>
the output however looks like this:
this is line 1 this is line 2

Is this some configuration issue?
I am using Win2K Pro with the XAMPP package v 1.3
php 4.3.4
apache 2.0.48

any help clearing up this mystery would be greatly appreciated so I can get
on learning php.

TIA,
jrg



2004-03-26, 11:13 pm


"jg" <jrg@nospam-weirdcat.com> wrote in message
news:%3_7c.413$eh7.262@news01.roc.ny...
> I posted the question earlier about the variables in the select statement
> (still doesn't work) I just noticed something else, \n does not work

either.
> Ex.
> <?php echo("this is line 1\n");
> echo("this is line 2\n");
> ?>
> the output however looks like this:
> this is line 1 this is line 2
>
> Is this some configuration issue?
> I am using Win2K Pro with the XAMPP package v 1.3
> php 4.3.4
> apache 2.0.48
>
> any help clearing up this mystery would be greatly appreciated so I can

get
> on learning php.
>
> TIA,
> jrg
>
>
>


/n (new line) will only work for raw output - like PHP command line.
It will also work if you "view source" in notepad or something.

But, \n means nothing to a browser that is looking for HTML tags. It will
be treated as a blank space (I think)
Use the HTML break <br>



Alvaro G Vicario

2004-03-26, 11:13 pm

*** jg wrote/escribió (Tue, 23 Mar 2004 17:01:47 GMT):
> <?php echo("this is line 1\n");
> echo("this is line 2\n");
> ?>
> the output however looks like this:
> this is line 1 this is line 2
>
> Is this some configuration issue?


HTML is defined that way: carriage returns are ignored. If you want to
convert carriage returns into HTML tags you need nl2br().


--
--
-- Álvaro G. Vicario - Burgos, Spain
--
jg

2004-03-26, 11:13 pm

Thanks Nikola, that's what I've been doing but couldn't figure out why the
examples from the manual won't work for me.

jrg

<Nikola Tesla> wrote in message news:qM6dnckL1LAM7f3dRVn-uw@comcast.com...
>
> "jg" <jrg@nospam-weirdcat.com> wrote in message
> news:%3_7c.413$eh7.262@news01.roc.ny...
statement[color=darkred]
> either.
> get
>
> /n (new line) will only work for raw output - like PHP command line.
> It will also work if you "view source" in notepad or something.
>
> But, \n means nothing to a browser that is looking for HTML tags. It will
> be treated as a blank space (I think)
> Use the HTML break <br>
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com