Special Characters in input fields

I am experiencing a problem where data loaded into input fields are being changed from special characters to actual characters which causes problems when submitted.

In other words, instead of: ñ
this character is displayed and submitted: ñ

The end result is question marks in the output.

What is the best way to manage this?

Michael

You’ll need to htmlentity it:


echo '<input type="text" name="myText" value="' . htmlentities('&ntilde;') . '" />';

This will output something like:


<input type="text" name="myText" value="&amp;ntilde;" />

Which will show an input in your HTML page containing: ñ

Brilliant! duh…