Solved

textarea problem

Posted on 2001-08-21
3
213 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

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

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…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

623 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