title: Is trim and htmlspecialchars safe?
body: <p>I have a little script which allows the user to save a text in the database. For this I used prepared Statements to prevent any SQL injections. -> The part where the user saves sth. in the DB is safe.</p>
  
  <p>Now I want to output the text of the user, I do this like that:</p>
  
  <p><code>echo'Text: '.trim (htmlspecialchars ($text)).'';</code></p>
  
  <p>Is this method safe? Are there better solutions? Should I rather prevent inserting all this special chars into the DB?</p>