On 2-Apr-2005, "Gregory" <itisgregory@yahoo.com> wrote:
[color=blue]
> I am working through the exercises in the book "Learning PHP 5". I am
> using OS 10.3.7, with Apache, Safari and IE. When I execute the
> following code, the newline "\n" does not work. The ouput is all on
> one line in both browsers. I read through the PHP website to no avail.
> What is wrong?
>[color=green]
> >From example 2-17: Operating on Variables[/color]
> <?php
> $price = 23.95;
> $tax_rate = 0.08;
> $tax_amount = $price * $tax_rate;
> $total_cost = $price + $tax_amount;
> $username = 'james';
> $domain = '@example.com';
> $email_address = $username . $domain;
>
> print 'The tax is ' .$tax_amount;
> print "\n";
> print 'The total cost is ' .$total_cost;
> print "\n";
> print $email_address;
> ?>[/color]
Remember browsers expect HTML. HYML interprets newline as white space. To
get a newline in HTML use
print "<br>";
--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to
jamesbutler@willglen.net (it's reserved for spammers)