Solved

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

Posted on 2001-06-21
4
145 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
4 Comments
 
LVL 5

Accepted Solution

by:
aryumin earned 100 total points
Comment Utility
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
Comment Utility
$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
Comment Utility
Please update/finalize this.
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Comment from expert accepted as answer.

Thank you
Computer101
E-E Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to run file 9 90
Convert OverPunch 25 57
Powershell variable with -SearchBase cmdlet 2 60
importing users to Security group 2 30
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
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 …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

11 Experts available now in Live!

Get 1:1 Help Now