?
Solved

How to preserve input formatting  of text which is saved to db ?

Posted on 2001-06-21
4
Medium Priority
?
159 Views
Last Modified: 2013-12-25
How can you preserve input formatting  of text which is submitted through an input box which spans several lines. By formatting, I mean break lines, tab , blank line etc... especially, if this input is saved to a database and then later retrived for viewing. Too many times, you submit a text which is nicely formatted, but when you view it again, it has lost all of its formatting and has become a single paragraph text which is incomprehensible.
Thanks all.
0
Comment
Question by:attila1
[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
4 Comments
 
LVL 5

Accepted Solution

by:
aryumin earned 400 total points
ID: 6217452
s/&/&/g;
s/"/"/g;
s/\t/ &nbp;  /g;
s/</&lt;/g;
s/>/&gt;/g;
s/\n/<br>/g;
0
 
LVL 1

Expert Comment

by:anant99
ID: 6223735
$whatever =~ s/\n/<br>/g;
$whatever =~ s/</&lt;/g;
$whatever =~ s/>/&rt;/g;
$whatever =~ s/"/&quot;/g;

$whatever is the name of variable which contains the contents of the input box.

Anant
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6699427
Please update/finalize this.
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6903866
Comment from expert accepted as answer.

Thank you
Computer101
E-E Moderator
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

765 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