Solved

textarea problem

Posted on 2001-08-21
3
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…

751 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