[prev in list] [next in list] [prev in thread] [next in thread]
List: msql-mysql-modules
Subject: Re: Help with Line Breaks from webform
From: Mayuran Yogarajah <mayuran.yogarajah () casalemedia ! com>
Date: 2004-08-26 18:59:00
Message-ID: 412E32F4.3000402 () casalemedia ! com
[Download RAW message or body]
Mayuran Yogarajah wrote:
> Douglas S. Davis wrote:
>
>> Hi,
>>
>> I have a web app that users use to submit information about the courses
>> they're teaching. They can either enter text into the textarea fields
>> manually, or by copying and pasting from another source (usually a
>> Microsoft
>> Word document). When they submit the form, a Perl program inserts
>> the data
>> into a MySQL table. But when I later issue a select command and get the
>> data out of the MySQL table to display on a webpage, the line breaks are
>> gone. What do I need to do so that the data remains formatted the
>> way it is
>> when it's entered into the webform?
>>
>>
>>
>> Douglas
>>
>> --------------------------------------
>> Douglas S. Davis
>> Programmer/Analyst
>> Haverford College
>> Department of Administrative Computing
>> 370 Lancaster Ave.
>> Haverford, PA 19041
>> 610-896-4206
>> dsdavis@haverford.edu
>> http://www.haverford.edu
>>
>>
>>
>>
> What kind of field are you storing the data into ? I was doing
> something similar and in order
> to get the linbreaks back by replacing the newline character with <br>.
>
That should read: I was doing something similar and in order to get the
linebreaks back I had to
replace the newline character with <br>. Sorry :P
> Ex:
> my $sth = $dbh->prepare (q{ SELECT summary FROM summary WHERE id = ?});
> $sth->execute ($cgi->param('id'));
> $sth->bind_columns (\my $summary);
> $sth->fetch();
>
> $summary =~ s/\n/<br>/g;
>
> Hope that helps,
> Mayuran
>
>
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=msql-mysql-modules@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic