I have a classified website, and I recently changed the insertion of classifieds to use php Session variables instead of alot of POST and FORMS...
So first BEFORE changing to Sessions, it worked nice and all special characters showed up correctly.
Now that I changed to SESSIONS, I get funny characters instead of the special characters.
Here is some code to explain better.
First is BEFORE changing to sessions: Below is the first page which shows a verification page (preview), where users may press "OK" or "Go back and change":
//VERIFICATION PAGE:
<form>
<input type="text" value="<?php echo htmlentities($_POST['annonsera_headline'], ENT_QUOTES, 'utf-8'); ?>">
//IF OK, THEN TO THE PAGE WHERE THE CLASSIFIED IS INSERTED
$headline= mysql_real_escape_string($_POST['headline']);
Now the above worked but then I changed to sessions:
//VERIFICATION PAGE:
$headline = htmlentities($_POST['annonsera_headline'], ENT_QUOTES, 'utf-8');
$_SESSION['headline'] = $headline;
//IF OK, THEN TO THE PAGE WHERE THE CLASSIFIED IS INSERTED
$headline= mysql_real_escape_string($_SESSION['headline']);
The above here changed all characters in the headline to corresponding HTML ENTITIES.
What should I do here?
And in my MySql headline field, there is no HTML ENTITY, there is the correct text. But on my webpages and in the classified the special characters show up funny, even though they are taken from the same mysql field (which looks good in phpmyadmin).
Any ideas?
Thanks