For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > September 2004 > Re: CGI.pm : Handling Carriage Returns from textarea()









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 Re: CGI.pm : Handling Carriage Returns from textarea()
Robert Page IV

2004-09-12, 8:55 pm

I am familiar with <br>. What is the difference between <br> and <br />?

Robert Page

On Sep 9, 2004, at 9:36 AM, Chad A Gard wrote:

>
> On Sep 8, 2004, at 9:40 PM, Robert Page IV wrote:
>
>
>
> Try this:
>
> $details = param('details');
> $details =~ s/\r/<br />/g;
>
> If you view source on the returned page now, you should see that there
> are carriage returns in the source code where they were input in your
> <textarea>. But, of course, HTML is (browser bugs notwithstanding)
> white space agnostic, so they're not being displayed. You could use a
> <pre>, but then you loose soft wrapping and many other formatting
> niceties.
>
> So, the easy answer is to substitute <br /> for your carriage returns.
>
>
>
> Chad A Gard
> http://www.percussionadvocates.com/chad
>
>
> --
> To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
> For additional commands, e-mail: beginners-cgi-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>

Robert C. Page IV

Sponsored Links







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

Copyright 2008 codecomments.com