[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2001-06-21
4
Medium Priority
?
165 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …
Suggested Courses

650 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