html_entity_decode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daveluff
Forum Newbie
Posts: 7
Joined: Fri Jul 23, 2004 6:32 am

html_entity_decode

Post by daveluff »

Hi there,
I'm not a php developer so please bear with me.
I am having trouble inserting french charachters into my mysql database.

I spoke to my hosting co and they recommended using html_entity_decode in my php forms.

Is this easy to do, I am simply recieving for vars from a flash file and i guess I need
to convert the utf setting of them. Does this sound like the right route?

Any ideas or guidance would be really appreciated,
Dave
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

When you recieve the value, BEFORE adding it to the database use html_entities() to convert it to its &#xx; value.

This should also display in the web page too since HTML read entities and displays them fine. If you need to convert back to the prignal value for any reason use html_entity_decode() :wink:

Code: Select all

$safe_insert_value = html_entities($_POST['var']); //Convert to entity
EDIT | Sorry, that would be htmlentities() [No underscore like I posted above]

http://www.php.net/htmlentities
Post Reply