Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

textarea problem

Posted on 2001-08-21
3
Medium Priority
?
216 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
Six Sigma Control Plans

877 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