LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] Links in a form.

[Webdev] Links in a form.

Raf turiel at Redbrick.DCU.ie
Mon Sep 11 17:01:53 IST 2000


On Mon, 11 Sep 2000, adam beecher wrote:

> > $details = ereg_replace(10,  "<BR>", $details);
> > $details = ereg_replace(13,  "", $details);
> >
> > And that will add a <br> to all the $details when it comes across a
> > linefeed.
> >
> Ummm, wha about nl2br()? Actually, nl2br() is imperfect - it screws up layouts
> because it doesn't really replace newlines, it just adds in a <BR> tag. If you
> .....

I asked this question on phpbuilder.com before and got the following
response:

----
nl2br() is probably not the best way to do it.

The following will replace blank lines with <P> and allow the the rest of the
copy to "flow" naturally.

$message = ereg_replace("\r\n\r\n", "\n<P>", $message);
----

It worked fine for me (in a message board application).






More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell