Re: Editing in a text area field

From: Date: Sat, 10 Jan 2009 22:01:28 +0000
Subject: Re: Editing in a text area field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-285983@lists.php.net to get a copy of this message
ceo@l-i-e.com wrote:
Rule #1. Never, ever, ever, alter the user's input, EXCEPT for sanitizing/filtering. Specifically, do NOT add <br /> tags in place of newlines. Store the newlines. Upon OUTPUT, you can use nl2br() to get <br /> tags. Or str_replace if you want </p> instead. This is crucial as a habit, down the road, when you later want to put their stuff out as non-HTML such as RSS or PDF or other output mechanisms. Consider their input as sacrosanct (except for dangerous/evil input) How do you suggest dealing with a need to allow italics, bold, underlines, etc?
I see forum web sites that allow the user to enter [b]bold text[/b] for example. I would like to do this. Anyone have a function to convert this kind of thing to HTML? Stephen

« previous php.general (#285983) next »