PHP santization of textarea input
No, don't do that. You seem to be filtering and escaping values out of paranoia rather than understanding what exactly would lead to a vulnerability. As a result, you are corrupting your data.

A well designed application should use the database to store the value that the user typed into the textarea, not some mangled representation of it. If you mangle the data like that before storing it, then:


Certain characters that the user typed get dropped. (What if the user input is x + 3 &lt; 5? The data would no longer make sense after you drop the &lt; character.)
Your database is not reliably searchable. (What if the user input is She said "yes!"? Then you would store a value in the database with &amp;quot; in it.)
If you arbitrarily apply escaping to string just in case, then you'll have a hard time keeping track of how to unescape it correctly when regurgitating the data. (This often leads to bugs where the user sees garbage like his &amp;amp; hers, or even worse, his &amp;amp;amp; hers.)


What's the right way? Don't mangle the data; just store it faithfully:

// store the content
$addPostStmt = $conn -&gt; prepare("
  INSERT INTO posts(description) VALUES (?)
");

$addPostStmt -&gt; bind_param("s", $_POST['userinput']); 
$addPostStmtExecute = $addPostStmt -&gt; execute();


When outputting the data as HTML, apply HTML escaping:

&lt;th&gt;Description:&lt;/th&gt;&lt;td&gt;&lt;?php echo htmlspecialchars($description); ?&gt;&lt;/td&gt;