Re: Editing in a text area field

From: Date: Fri, 09 Jan 2009 19:38:32 +0000
Subject: Re: Editing in a text area field
Groups: php.general 
Request: Send a blank email to php-general+get-285894@lists.php.net to get a copy of this message
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).

« previous php.general (#285894) next »