I am writing a program, and I am using \n in double-quoted print statements,
which should give me a line break. It doesn't work. I'm running Apache 2.0
and PHP 5, with Mozilla Firefox as a browser. What is wrong? 11 9822
Michael Bradley-Robbins wrote: I am writing a program, and I am using \n in double-quoted print statements, which should give me a line break. It doesn't work. I'm running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser. What is wrong?
And... you're not confusing \n <--> <br /> ?
Hans
--
"He who asks a question is a fool for five minutes;
he who does not ask a question remains a fool forever"
Michael Bradley-Robbins wrote: I am writing a program, and I am using \n in double-quoted print statements, which should give me a line break. It doesn't work. I'm running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser. What is wrong?
Look at the source (view-source in your browser) or wrap the output in
<pre></pre> tags.
JW
Michael Bradley-Robbins wrote: I am writing a program, and I am using \n in double-quoted print statements, which should give me a line break. It doesn't work. I'm running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser. What is wrong?
This one needs to go in the FAQ list.
\n gives you a newline break in the data sent to the browser, so if you
select the view source option in your browser you'll see the source
does indeed have a linebreak where you are expecting it. However,
linebreaks are ignored in HTML. To create a line break in HTML which is
rendered in the browser, you need the <br> tag.
--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Chris Hope wrote: Michael Bradley-Robbins wrote:
I am writing a program, and I am using \n in double-quoted print statements, which should give me a line break. It doesn't work. I'm running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser. What is wrong? This one needs to go in the FAQ list.
of an HTML group? I am sure it is. :-D.
\n gives you a newline break in the data sent to the browser, so if you select the view source option in your browser you'll see the source does indeed have a linebreak where you are expecting it. However, linebreaks are ignored in HTML. To create a line break in HTML which is rendered in the browser, you need the <br> tag.
Depends on what you want, it could be that you don't *want* the br element.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
John Bokma wrote: Chris Hope wrote:
Michael Bradley-Robbins wrote:
I am writing a program, and I am using \n in double-quoted print statements, which should give me a line break. It doesn't work. I'm running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser. What is wrong?
This one needs to go in the FAQ list.
of an HTML group? I am sure it is. :-D.
Heh - yes it's basic fundamental HTML skills we're talking about here.
Although I've seen this same question asked here a few times now... \n gives you a newline break in the data sent to the browser, so if you select the view source option in your browser you'll see the source does indeed have a linebreak where you are expecting it. However, linebreaks are ignored in HTML. To create a line break in HTML which is rendered in the browser, you need the <br> tag.
Depends on what you want, it could be that you don't *want* the br element.
Very true. I was making an assumption based on the same experience other
people have had when posting here about this problem. Plus it seems
very unlikely that print "\n" does not output a newline break ;)
--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Here's something that may help - especially if you have a bunch of
\n(s) in a database somewhere that you are generating dynamic pages
with (that you would like to see the line breaks in). http://us2.php.net/nl2br
This little baby will insert a <BR> before any \n in whatever variable
or string you pass to it. I use this for pages where users get to type
info into a field and hit \n\n to create a new paragraph. When they
submit it to a database, it is raw, but when I pull it out, I pass it
through nl2br and it adds the <BR>(s) for me.
Not sure if that's what you are looking for, but it's worth saying just
in case.
Shane
Chris Hope <bl*******@elec trictoolbox.com > wrote: This one needs to go in the FAQ list.
of an HTML group? I am sure it is. :-D.
Heh - yes it's basic fundamental HTML skills we're talking about here. Although I've seen this same question asked here a few times now...
It already is (kind of):
msgid: 42************* **********@news 6.xs4all.nl
Subject: [FAQ] HTML is trunctating PHP text
Take a look at the source (the first place you should look to see what
PHP is actually doing) and you will see it's all there as
Chris Hope <bl*******@elec trictoolbox.com > wrote: Very true. I was making an assumption based on the same experience other people have had when posting here about this problem. Plus it seems very unlikely that print "\n" does not output a newline break ;)
It DOES output a newline break. Do a View->Source to prove it.
The issue is that newlines in HTML are just plain old white space, and are
removed when the page is rendered.
To get a line break rendered, you need to output a <br> tag.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: AnnMarie |
last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it
works fine in IE.
I made some of the suggested changes which enabled it to work in IE.
I couldn't make all the changes because then it didn't work in IE.
How can I enable this javascipt form validation to work in Netscape?
When I use netscape, none of the alert boxes appear. It submits the
form without validating anything.
|
by: Mark Johnson |
last post by:
It doesn't seem possible. But would the following also seem a
violation of the general notions behind css?
You have a DIV, say asociated with class, 'topdiv'.
Inside of that you have an anchor (and whatever it contains),
associated with class, 'a'.
Somewhere else in, 'topdiv', there is a span or element (containing
whatever), associated with class, 'b'.
|
by: Matt |
last post by:
I want to know if readOnly attribute doesn't work for drop down list?
If I try disabled attribute, it works fine for drop down list. When I
try text box, it works fine for both disabled and readOnly attribute.
For example, #1 will work, but #2 doesn't work
1) <SELECT name="streetDirection" class="FormInput" DISABLED>
In JavaScript, I have InputForm.streetDirection.disabled = false;
2) <SELECT name="streetDirection" class="FormInput"...
|
by: Christopher Benson-Manica |
last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.)
strchr() is to strrchr() as strstr() is to strrstr(), but strrstr()
isn't part of the standard. Why not?
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
|
by: A.M-SG |
last post by:
Hi,
I have an aspx page at the web server that provides PDF documents for smart
client applications.
Here is the code in aspx page that defines content type:
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" +
fileID.ToString() + ".pdf");
| |
by: bbp |
last post by:
Hello,
In an ASPX page I have a "Quit" button which make a simple redirect in
code-behind.
This button doesn't work no more since (I think) I moved from the framework
1.0 to 1.1
and it doesn't work only on IE! My ASPX page works in FireFox.
If the button doesn't work it's because of validators (and it worked with
the same code in v1.0).
|
by: Dave Moore |
last post by:
Hi All,
Ok, here's my problem. I want to open a file and process its contents.
However, because it is possible that the file may not exist, I also want to
check whether the file() function is successful before attempting to process
any returned data from the file() function. The php file() manual page
suggests that it returns FALSE if it is unsuccessful, however this simply
doesn't happen on my system. My code looks like the following:
...
|
by: Sourcerer |
last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend's computer (he doesn't have the compiler). We both
have Windows XP Professional. I have .NET framework 2.0, and he had 1.0 and it
didn't work; then he installed 2.0 and it still didn't work; so he tried with
2.1 and it didn't work, then 3.0 and nothing still worked. I have Intel Centrino
Mobile (laptop computer), and he has Intel Pentium...
|
by: Johnny Jörgensen |
last post by:
I've got a usercontrol derived from a normal ComboBox that contains some
special formatting code. On my main form I've got a lot of my custom
comboboxes.
I discovered a bug in the derived control and fixed it. But it still doesn't
work for the controls already added to the form. It works fine for new
instances of the control dragged from the toolbox to the form.
I don't want to have to drag and drop new controls to exchange all my old...
|
by: alex |
last post by:
I've converted a latin1 database I have to utf8. The process has been:
# mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore
--skip-set-charset mydb mydb.sql
# iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql
mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |