I have an application which permits a user to edit html templates which are stored in a mySQL table. The templates consist of html code snippets and may include characters such as '&-nbsp;' (non-breaking space).
In my edit-template.php script, I echo the template into a textarea so that the user can edit it. Here's the problem. If a template includes the '&-nbsp;' character, when it is echoed into the textarea, it appears as a space. When the form is submitted, it seems to be converted into a space and is stored in the database as a space.
How can I show the '&-nbsp;' character in the textarea so that a user may edit it, but still store it literally as '&-nbsp;' in the database after the form is submitted?