Re: Help with Line Breaks from webform
Mayuran Yogarajah <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
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 >> [email protected] >> 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/[email protected]