Don't store it with nl2br
. You should only store the raw data that is posted. If you want to update it for display, use nl2br
at that time.
if ($storing) {
$dbstmt->execute($_POST['textarea-value']);
}
else {
$textareaValue = $db->query($select);
echo "<div>" . nl2br(htmlspecialchars($textareaValue)) . "</div>";
echo "<textarea>" . htmlspecialchars($textareaValue) . "</textarea>";
}