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.

adam beecher adam at iewebs.com
Mon Sep 11 15:47:06 IST 2000


> Hi all I have figured out how to get a form to add a line break to it's
> self:
>
> $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
use an odd font, it can screw up the spacing on the last sentence in a
paragraph. If you don't though, it does exactly the same thing. I'm curious
about the above though - do the numbers represent characters, yeah? So 10 is \n
right, but what's 13? \r? Also, can you use the same syntax in str_replace()? If
you can, you should use that - lower overhead.

> However I also want it to scat the $details and if it finds a url
> replace it with a hyperlink. so if I submitted either http://www.anton.com
> or just www.anton.com if would prnit out <a
> href="http://www.anton.com">http://www.anton.com</a>.
>
Search on phpbuilder.com for terms like "parse" and "url". It's been covered
there plenty of times, so you should be able to pull it from there. I'll have a
look myself later, because I've searched for this before. I can't find the code
though, and I couldn't be arsed trying to write it again... :)

adam





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