Solved

textarea problem

Posted on 2001-08-21
3
207 Views
Last Modified: 2012-05-04
i want to insert textarea data into my database which is the flat textbased type not mySQL nor MSSQL.

problem is, when my user press on the 'enter' inside the textarea. the notepad will break into another line... so how can i capture the break <br> and when i do insertion into the database, it remains one single line..

pls advise,

urgent...!!
0
Comment
Question by:feli7
3 Comments
 
LVL 1

Expert Comment

by:mrmicky
Comment Utility
As part of your form processing, you can convert '\n' to '<BR>' before sending it to the database.
0
 
LVL 3

Accepted Solution

by:
interiot earned 50 total points
Comment Utility
If the database's record separators are CR/LF, then the only choice is to escape newlines somehow.  You can, as you suggested, convert \n's to <BR>s, but you'll also want to then encode <'s, >'s, and &'s:

    $str =~ s/&/&amp;/g;
    $str =~ s/</&lt;/g;
    $str =~ s/>/&gt;/g;
    $str =~ s/\n/<BR>/g;
0
 

Author Comment

by:feli7
Comment Utility
great help!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video discusses moving either the default database or any database to a new volume.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now