In PHP, how can I store a string from an input field in a MySQL database, and then retrieve them and display them on a page exactly like it was typed into the input field? It shouldn't matter what type of character encoding is used, even if it's a Chinese or something like that. What functions do I need to apply to the strings in PHP? And what collation do I need to use for my database?
You need to set the character encoding collation in your mysql database: e.g.
utf8_general_ci
and you need to set the encoding of your page to display the driven content as they are: e.g.
header('Content-type: text/html; charset=utf-8; http-equiv=Content-Type');