You cannot prevent client input. You can add things to interfere (or try), but it will always be trivial to send malicious code. You NEED to sanitize in PHP.
ALWAYS ALWAYS ALWAYS avoid user-submitted content before displaying it ( htmlentities will usually take care of this for you).
If you want to have an HTML message (as you say, you want WYSIWYG), you need the whitelist to clear the HTML that was sent. When I say whitelist, I mean both the tag name and the attribute.
I am not familiar with CodeIgniter, but found this one that looks like it can do what you want ...
ircmaxell
source share