Solved

textarea problem

Posted on 2001-08-21
3
208 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
ID: 6410706
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
ID: 6410724
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
ID: 6426267
great help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

930 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

10 Experts available now in Live!

Get 1:1 Help Now